chore: update permalink configuration and content organization

Modified hugo.toml to use section in post front-matter for permalinks

Updated layouts/_default/single.html to handle posts without categories

Modified scripts/generate-content.js to organize content by category

Deleted content/_index.md and added new category directories
This commit is contained in:
kbe
2025-08-18 16:39:27 +02:00
parent 34084f1481
commit 710e63afda
266 changed files with 21494 additions and 27 deletions

View File

@@ -2,11 +2,11 @@ const fs = require('fs');
const path = require('path');
const DATA_DIR = path.join(__dirname, '..', 'data', 'wordpress');
const CONTENT_DIR = path.join(__dirname, '..', 'content', 'posts');
const CONTENT_DIR = path.join(__dirname, '..', 'content');
function generateContent() {
const posts = JSON.parse(fs.readFileSync(path.join(DATA_DIR, 'posts.json'), 'utf8'));
// Ensure content directory exists
if (!fs.existsSync(CONTENT_DIR)) {
fs.mkdirSync(CONTENT_DIR, { recursive: true });
@@ -17,9 +17,14 @@ function generateContent() {
const date = new Date(post.date);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const contentDir = path.join(CONTENT_DIR, `${year}-${month}-${slug}`);
// Get the primary category (first category in the list)
const primaryCategory = post._embedded?.['wp:term']?.[0]?.[0];
const categorySlug = primaryCategory ? primaryCategory.slug : 'non-classe';
const contentDir = path.join(CONTENT_DIR, categorySlug, `${year}-${month}-${slug}`);
// const contentDir = path.join(CONTENT_DIR, `${year}-${month}-${slug}`);
if (!fs.existsSync(contentDir)) {
fs.mkdirSync(contentDir, { recursive: true });
}
@@ -45,7 +50,8 @@ function generateContent() {
id: tag.id,
name: tag.name,
slug: tag.slug
})) || []
})) || [],
// section: categorySlug
};
const content = `---