fix(hexojs): Remove /blog root path, use / as root

Change all hardcoded /blog/ paths to use / as root:

Theme configuration:
- _config.yml: Menu paths now /cybersecurity/ instead of /blog/cybersecurity/
- Blog submenu path changed to /categories/

Layout templates:
- post.ejs: Category link uses url_for with root path
- index.ejs: "Voir le blog" links to /categories/
- category.ejs: Breadcrumb and back links use /categories/

Scripts:
- dynamic-blog.js: Category paths now /{slug}/ instead of /blog/{slug}/
- Menu blog path changed to /categories/

Presets:
- tech.yml: Menu paths updated
- portfolio.yml: Blog link updated

hexoctl:
- Default portal_path changed from /www/blog to /www
- Help text updated

This allows the blog to be served from the root URL with categories
at /{category}/ paths.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-01-24 15:37:01 +01:00
parent 172fd42072
commit b7b6332112
8 changed files with 21 additions and 21 deletions

View File

@ -102,7 +102,7 @@ Build Commands:
build Generate static files build Generate static files
clean Clean generated files clean Clean generated files
deploy Deploy to configured git target deploy Deploy to configured git target
publish Copy static files to /www/blog/ publish Copy static files to /www/
Service Commands: Service Commands:
service-run Run in foreground (for init) service-run Run in foreground (for init)
@ -818,7 +818,7 @@ cmd_publish() {
load_config load_config
local public_dir="$data_path/site/public" local public_dir="$data_path/site/public"
local portal_path="/www/blog" local portal_path="/www"
local config_file="$data_path/site/_config.yml" local config_file="$data_path/site/_config.yml"
# Allow custom portal path from config # Allow custom portal path from config

View File

@ -19,7 +19,7 @@ menu:
Home: / Home: /
Projects: /portfolio/ Projects: /portfolio/
Services: /services/ Services: /services/
Blog: /blog/ Blog: /categories/
Contact: /contact/ Contact: /contact/
sections: sections:

View File

@ -18,11 +18,11 @@ branding:
menu: menu:
Home: / Home: /
Blog: Blog:
_path: /blog/ _path: /categories/
Security: /blog/security/ Security: /security/
Linux: /blog/linux/ Linux: /linux/
Development: /blog/dev/ Development: /dev/
Tutorials: /blog/tutorials/ Tutorials: /tutorials/
Projects: /portfolio/ Projects: /portfolio/
About: /about/ About: /about/

View File

@ -33,13 +33,13 @@ branding:
menu: menu:
Accueil: / Accueil: /
Blog: Blog:
_path: /blog/ _path: /categories/
🛡️ Cybersécurité: /blog/cybersecurity/ 🛡️ Cybersécurité: /cybersecurity/
⚙️ Embarqué: /blog/embedded/ ⚙️ Embarqué: /embedded/
🐧 Linux: /blog/linux/ 🐧 Linux: /linux/
🎨 Créativité: /blog/creative/ 🎨 Créativité: /creative/
🧘 Philosophie: /blog/philosophy/ 🧘 Philosophie: /philosophy/
📖 Tutoriels: /blog/tutorials/ 📖 Tutoriels: /tutorials/
Apps: /apps/ Apps: /apps/
Services: /services/ Services: /services/
Portfolio: /portfolio/ Portfolio: /portfolio/

View File

@ -68,7 +68,7 @@ if (typeof get_blog_categories === 'function') {
<% if (catDesc) { %><p class="cat-desc"><%= catDesc %></p><% } %> <% if (catDesc) { %><p class="cat-desc"><%= catDesc %></p><% } %>
<p class="cat-count"><%= postCount %> article<%= postCount > 1 ? 's' : '' %></p> <p class="cat-count"><%= postCount %> article<%= postCount > 1 ? 's' : '' %></p>
<nav class="breadcrumb"> <nav class="breadcrumb">
<a href="<%= url_for('/') %>">Accueil</a> / <a href="<%= url_for('blog/') %>">Blog</a> / <span><%= catName %></span> <a href="<%= url_for('/') %>">Accueil</a> / <a href="<%= url_for('/categories/') %>">Blog</a> / <span><%= catName %></span>
</nav> </nav>
</header> </header>
@ -127,7 +127,7 @@ if (typeof get_blog_categories === 'function') {
<% } else { %> <% } else { %>
<div class="no-posts"> <div class="no-posts">
<p>🚧 Aucun article dans cette catégorie pour le moment.</p> <p>🚧 Aucun article dans cette catégorie pour le moment.</p>
<p><a href="<%= url_for('blog/') %>">← Retour au blog</a></p> <p><a href="<%= url_for('/categories/') %>">← Retour au blog</a></p>
</div> </div>
<% } %> <% } %>
</section> </section>

View File

@ -478,7 +478,7 @@ if (typeof get_blog_categories === 'function') {
</div> </div>
<div class="section-footer"> <div class="section-footer">
<a href="/blog/" class="btn btn-secondary">Voir le blog →</a> <a href="<%= url_for('/categories/') %>" class="btn btn-secondary">Voir le blog →</a>
</div> </div>
</section> </section>
<% } %> <% } %>

View File

@ -83,7 +83,7 @@ if (page.tags && page.tags.length > 0) {
<header class="post-header"> <header class="post-header">
<% if (hasCategory) { %> <% if (hasCategory) { %>
<div class="post-category"> <div class="post-category">
<a href="/blog/<%= categorySlug %>/" style="color: <%= categoryColor %>"> <a href="<%= url_for('/' + categorySlug + '/') %>" style="color: <%= categoryColor %>">
<%= categoryIcon %> <%= categoryName %> <%= categoryIcon %> <%= categoryName %>
</a> </a>
</div> </div>

View File

@ -126,7 +126,7 @@ function scanCategories(hexo) {
color: DEFAULT_COLORS[orderIndex % DEFAULT_COLORS.length], color: DEFAULT_COLORS[orderIndex % DEFAULT_COLORS.length],
description: '', description: '',
order: 100 + orderIndex, order: 100 + orderIndex,
path: `/blog/${slug}/` path: `/${slug}/`
}; };
// Lire les métadonnées depuis index.md si présent // Lire les métadonnées depuis index.md si présent
@ -360,7 +360,7 @@ hexo.extend.helper.register('get_dynamic_menu', function() {
const blogMenu = { const blogMenu = {
name: 'Blog', name: 'Blog',
icon: '📚', icon: '📚',
path: '/blog/', path: '/categories/',
children: categories.map(cat => ({ children: categories.map(cat => ({
name: cat.name, name: cat.name,
icon: cat.icon, icon: cat.icon,