Mise à jour du plugin carrousel et sidebar

This commit is contained in:
Tellsanguis 2025-12-19 12:30:48 +01:00
parent 74bb369ea2
commit 7af29ab6e5
4 changed files with 23 additions and 17 deletions

View file

@ -74,15 +74,31 @@ module.exports = function pluginRecentArticles(context, options) {
const recentBlog = blogArticles.slice(0, 3); const recentBlog = blogArticles.slice(0, 3);
const recentDocs = docArticles.slice(0, 3); const recentDocs = docArticles.slice(0, 3);
// Intercalate blog and documentation articles: blog, doc, blog, doc, blog, doc // Determine which type has the most recent content
const mostRecentBlog = recentBlog.length > 0 ? new Date(recentBlog[0].date) : new Date(0);
const mostRecentDoc = recentDocs.length > 0 ? new Date(recentDocs[0].date) : new Date(0);
const startWithBlog = mostRecentBlog >= mostRecentDoc;
// Intercalate blog and documentation articles, starting with the most recent type
const articles = []; const articles = [];
for (let i = 0; i < Math.max(recentBlog.length, recentDocs.length); i++) { for (let i = 0; i < Math.max(recentBlog.length, recentDocs.length); i++) {
if (startWithBlog) {
// Start with blog: blog, doc, blog, doc, blog, doc
if (i < recentBlog.length) { if (i < recentBlog.length) {
articles.push(recentBlog[i]); articles.push(recentBlog[i]);
} }
if (i < recentDocs.length) { if (i < recentDocs.length) {
articles.push(recentDocs[i]); articles.push(recentDocs[i]);
} }
} else {
// Start with doc: doc, blog, doc, blog, doc, blog
if (i < recentDocs.length) {
articles.push(recentDocs[i]);
}
if (i < recentBlog.length) {
articles.push(recentBlog[i]);
}
}
} }
// Store globally for use in React components // Store globally for use in React components

View file

@ -61,17 +61,7 @@ const sidebars: SidebarsConfig = {
'homelab-futur/cluster-3-noeuds-proxmox', 'homelab-futur/cluster-3-noeuds-proxmox',
], ],
}, },
{ 'zfs-replication-nfs',
type: 'category',
label: 'Infrastructure de stockage',
link: {
type: 'doc',
id: 'zfs-replication-nfs/index',
},
items: [
'zfs-replication-nfs/index',
],
},
], ],
}; };