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:
parent
172fd42072
commit
b7b6332112
@ -102,7 +102,7 @@ Build Commands:
|
||||
build Generate static files
|
||||
clean Clean generated files
|
||||
deploy Deploy to configured git target
|
||||
publish Copy static files to /www/blog/
|
||||
publish Copy static files to /www/
|
||||
|
||||
Service Commands:
|
||||
service-run Run in foreground (for init)
|
||||
@ -818,7 +818,7 @@ cmd_publish() {
|
||||
load_config
|
||||
|
||||
local public_dir="$data_path/site/public"
|
||||
local portal_path="/www/blog"
|
||||
local portal_path="/www"
|
||||
local config_file="$data_path/site/_config.yml"
|
||||
|
||||
# Allow custom portal path from config
|
||||
|
||||
@ -19,7 +19,7 @@ menu:
|
||||
Home: /
|
||||
Projects: /portfolio/
|
||||
Services: /services/
|
||||
Blog: /blog/
|
||||
Blog: /categories/
|
||||
Contact: /contact/
|
||||
|
||||
sections:
|
||||
|
||||
@ -18,11 +18,11 @@ branding:
|
||||
menu:
|
||||
Home: /
|
||||
Blog:
|
||||
_path: /blog/
|
||||
Security: /blog/security/
|
||||
Linux: /blog/linux/
|
||||
Development: /blog/dev/
|
||||
Tutorials: /blog/tutorials/
|
||||
_path: /categories/
|
||||
Security: /security/
|
||||
Linux: /linux/
|
||||
Development: /dev/
|
||||
Tutorials: /tutorials/
|
||||
Projects: /portfolio/
|
||||
About: /about/
|
||||
|
||||
|
||||
@ -33,13 +33,13 @@ branding:
|
||||
menu:
|
||||
Accueil: /
|
||||
Blog:
|
||||
_path: /blog/
|
||||
🛡️ Cybersécurité: /blog/cybersecurity/
|
||||
⚙️ Embarqué: /blog/embedded/
|
||||
🐧 Linux: /blog/linux/
|
||||
🎨 Créativité: /blog/creative/
|
||||
🧘 Philosophie: /blog/philosophy/
|
||||
📖 Tutoriels: /blog/tutorials/
|
||||
_path: /categories/
|
||||
🛡️ Cybersécurité: /cybersecurity/
|
||||
⚙️ Embarqué: /embedded/
|
||||
🐧 Linux: /linux/
|
||||
🎨 Créativité: /creative/
|
||||
🧘 Philosophie: /philosophy/
|
||||
📖 Tutoriels: /tutorials/
|
||||
Apps: /apps/
|
||||
Services: /services/
|
||||
Portfolio: /portfolio/
|
||||
|
||||
@ -68,7 +68,7 @@ if (typeof get_blog_categories === 'function') {
|
||||
<% if (catDesc) { %><p class="cat-desc"><%= catDesc %></p><% } %>
|
||||
<p class="cat-count"><%= postCount %> article<%= postCount > 1 ? 's' : '' %></p>
|
||||
<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>
|
||||
</header>
|
||||
|
||||
@ -127,7 +127,7 @@ if (typeof get_blog_categories === 'function') {
|
||||
<% } else { %>
|
||||
<div class="no-posts">
|
||||
<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>
|
||||
<% } %>
|
||||
</section>
|
||||
|
||||
@ -478,7 +478,7 @@ if (typeof get_blog_categories === 'function') {
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</section>
|
||||
<% } %>
|
||||
|
||||
@ -83,7 +83,7 @@ if (page.tags && page.tags.length > 0) {
|
||||
<header class="post-header">
|
||||
<% if (hasCategory) { %>
|
||||
<div class="post-category">
|
||||
<a href="/blog/<%= categorySlug %>/" style="color: <%= categoryColor %>">
|
||||
<a href="<%= url_for('/' + categorySlug + '/') %>" style="color: <%= categoryColor %>">
|
||||
<%= categoryIcon %> <%= categoryName %>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -126,7 +126,7 @@ function scanCategories(hexo) {
|
||||
color: DEFAULT_COLORS[orderIndex % DEFAULT_COLORS.length],
|
||||
description: '',
|
||||
order: 100 + orderIndex,
|
||||
path: `/blog/${slug}/`
|
||||
path: `/${slug}/`
|
||||
};
|
||||
|
||||
// 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 = {
|
||||
name: 'Blog',
|
||||
icon: '📚',
|
||||
path: '/blog/',
|
||||
path: '/categories/',
|
||||
children: categories.map(cat => ({
|
||||
name: cat.name,
|
||||
icon: cat.icon,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user