Move blog index to /index, homepage renders Ghost "home" page
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m3s

/ now renders the Ghost page with slug "home" (site homepage).
/index serves the existing blog listing (posts, pages, filters).
All blog.home references updated to blog.index.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-23 16:54:09 +00:00
parent ff5ce235a4
commit 5f97c7cf46
3 changed files with 23 additions and 4 deletions

View File

@@ -80,6 +80,25 @@ def register(url_prefix, title):
@blogs_bp.get("/")
async def home():
"""Render the Ghost page with slug 'home' as the site homepage."""
from ..post.services.post_data import post_data as _post_data
p_data = await _post_data("home", g.s, include_drafts=False)
if not p_data:
# Fall back to blog index if "home" page doesn't exist yet
return redirect(host_url(url_for("blog.index")))
g.post_data = p_data
if not is_htmx_request():
html = await render_template("_types/post/index.html", **p_data)
else:
html = await render_template("_types/post/_oob_elements.html", **p_data)
return await make_response(html)
@blogs_bp.get("/index")
@blogs_bp.get("/index/")
async def index():
"""Blog listing — moved from / to /index."""
q = decode()
content_type = request.args.get("type", "posts")
@@ -303,6 +322,6 @@ def register(url_prefix, title):
@blogs_bp.get("/drafts/")
async def drafts():
return redirect(host_url(url_for("blog.home")) + "?drafts=1")
return redirect(host_url(url_for("blog.index")) + "?drafts=1")
return blogs_bp

2
shared

Submodule shared updated: 9cb8cf9e1d...38233279a2

View File

@@ -1,8 +1,8 @@
{# Content type tabs: Posts | Pages #}
<div class="flex justify-center gap-1 px-3 pt-3">
{% set posts_href = (url_for('blog.home'))|host %}
{% set pages_href = (url_for('blog.home') ~ '?type=pages')|host %}
{% set posts_href = (url_for('blog.index'))|host %}
{% set pages_href = (url_for('blog.index') ~ '?type=pages')|host %}
<a
href="{{ posts_href }}"
hx-get="{{ posts_href }}"