All pages are displayed but only published must
This commit is contained in:
@@ -7,14 +7,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-6 col-sm-6 col-lg-3">
|
<div class="col-6 col-sm-6 col-lg-3">
|
||||||
<h6 class="font-small fw-medium uppercase">Catégories</h6>
|
<h6 class="font-small fw-medium uppercase">Pages</h6>
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li><a href="/">Accueil</a></li>
|
<li><a href="/">Accueil</a></li>
|
||||||
{{ if .Site.Data.wordpress }}
|
{{ if .Site.Data.wordpress }}
|
||||||
{{ $count := 0 }}
|
|
||||||
{{ range $index, $element := .Site.Data.wordpress.navigation }}
|
{{ range $index, $element := .Site.Data.wordpress.navigation }}
|
||||||
<li class="nav-item">
|
<li>
|
||||||
<a class="nav-link" href="/{{ $element.slug }}">{{ $element.title }}</a>
|
<a href="/{{ $element.slug }}">{{ $element.title }}</a>
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ function generateContent() {
|
|||||||
fs.mkdirSync(PAGES_DIR, { recursive: true });
|
fs.mkdirSync(PAGES_DIR, { recursive: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process posts
|
// Process posts - only include published posts
|
||||||
posts.forEach(post => {
|
posts.filter(post => post.status === 'publish').forEach(post => {
|
||||||
const slug = post.slug;
|
const slug = post.slug;
|
||||||
const date = new Date(post.date);
|
const date = new Date(post.date);
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
@@ -40,7 +40,7 @@ function generateContent() {
|
|||||||
const frontmatter = {
|
const frontmatter = {
|
||||||
title: he.decode(post.title.rendered),
|
title: he.decode(post.title.rendered),
|
||||||
date: post.date,
|
date: post.date,
|
||||||
draft: post.status !== 'publish',
|
draft: false,
|
||||||
slug: slug,
|
slug: slug,
|
||||||
wordpress_id: post.id,
|
wordpress_id: post.id,
|
||||||
excerpt: he.decode(post.excerpt.rendered.replace(/<[^>]*>/g, '')),
|
excerpt: he.decode(post.excerpt.rendered.replace(/<[^>]*>/g, '')),
|
||||||
@@ -80,8 +80,8 @@ ${contentHtml.trim()}`;
|
|||||||
fs.writeFileSync(path.join(contentDir, 'index.md'), content);
|
fs.writeFileSync(path.join(contentDir, 'index.md'), content);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Process pages
|
// Process pages - only include published pages
|
||||||
pages.forEach(page => {
|
pages.filter(page => page.status === 'publish').forEach(page => {
|
||||||
const slug = page.slug;
|
const slug = page.slug;
|
||||||
|
|
||||||
const contentDir = path.join(PAGES_DIR, slug);
|
const contentDir = path.join(PAGES_DIR, slug);
|
||||||
@@ -98,7 +98,7 @@ ${contentHtml.trim()}`;
|
|||||||
wordpress_id: page.id,
|
wordpress_id: page.id,
|
||||||
date: page.date,
|
date: page.date,
|
||||||
modified: page.modified,
|
modified: page.modified,
|
||||||
draft: page.status !== 'publish',
|
draft: false,
|
||||||
aliases: [`/${slug}/`]
|
aliases: [`/${slug}/`]
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -131,8 +131,10 @@ ${contentHtml.trim()}`;
|
|||||||
fs.writeFileSync(path.join(contentDir, 'index.md'), content);
|
fs.writeFileSync(path.join(contentDir, 'index.md'), content);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`✅ Generated ${posts.length} content files`);
|
const publishedPosts = posts.filter(post => post.status === 'publish');
|
||||||
console.log(`✅ Generated ${pages.length} page files`);
|
const publishedPages = pages.filter(page => page.status === 'publish');
|
||||||
|
console.log(`✅ Generated ${publishedPosts.length} content files`);
|
||||||
|
console.log(`✅ Generated ${publishedPages.length} page files`);
|
||||||
}
|
}
|
||||||
|
|
||||||
generateContent();
|
generateContent();
|
||||||
Reference in New Issue
Block a user