Move blog index to /index, homepage renders Ghost "home" page
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m3s
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:
@@ -80,6 +80,25 @@ def register(url_prefix, title):
|
|||||||
|
|
||||||
@blogs_bp.get("/")
|
@blogs_bp.get("/")
|
||||||
async def home():
|
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()
|
q = decode()
|
||||||
content_type = request.args.get("type", "posts")
|
content_type = request.args.get("type", "posts")
|
||||||
@@ -303,6 +322,6 @@ def register(url_prefix, title):
|
|||||||
|
|
||||||
@blogs_bp.get("/drafts/")
|
@blogs_bp.get("/drafts/")
|
||||||
async def 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
|
return blogs_bp
|
||||||
2
shared
2
shared
Submodule shared updated: 9cb8cf9e1d...38233279a2
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
{# Content type tabs: Posts | Pages #}
|
{# Content type tabs: Posts | Pages #}
|
||||||
<div class="flex justify-center gap-1 px-3 pt-3">
|
<div class="flex justify-center gap-1 px-3 pt-3">
|
||||||
{% set posts_href = (url_for('blog.home'))|host %}
|
{% set posts_href = (url_for('blog.index'))|host %}
|
||||||
{% set pages_href = (url_for('blog.home') ~ '?type=pages')|host %}
|
{% set pages_href = (url_for('blog.index') ~ '?type=pages')|host %}
|
||||||
<a
|
<a
|
||||||
href="{{ posts_href }}"
|
href="{{ posts_href }}"
|
||||||
hx-get="{{ posts_href }}"
|
hx-get="{{ posts_href }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user