Mise à jour du plugin carrousel et sidebar
This commit is contained in:
parent
74bb369ea2
commit
7af29ab6e5
4 changed files with 23 additions and 17 deletions
|
|
@ -74,14 +74,30 @@ module.exports = function pluginRecentArticles(context, options) {
|
|||
const recentBlog = blogArticles.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 = [];
|
||||
for (let i = 0; i < Math.max(recentBlog.length, recentDocs.length); i++) {
|
||||
if (i < recentBlog.length) {
|
||||
articles.push(recentBlog[i]);
|
||||
}
|
||||
if (i < recentDocs.length) {
|
||||
articles.push(recentDocs[i]);
|
||||
if (startWithBlog) {
|
||||
// Start with blog: blog, doc, blog, doc, blog, doc
|
||||
if (i < recentBlog.length) {
|
||||
articles.push(recentBlog[i]);
|
||||
}
|
||||
if (i < recentDocs.length) {
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
12
sidebars.ts
12
sidebars.ts
|
|
@ -61,17 +61,7 @@ const sidebars: SidebarsConfig = {
|
|||
'homelab-futur/cluster-3-noeuds-proxmox',
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Infrastructure de stockage',
|
||||
link: {
|
||||
type: 'doc',
|
||||
id: 'zfs-replication-nfs/index',
|
||||
},
|
||||
items: [
|
||||
'zfs-replication-nfs/index',
|
||||
],
|
||||
},
|
||||
'zfs-replication-nfs',
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue