diff --git a/bp/blog/routes.py b/bp/blog/routes.py index e5b3083..b00c1c0 100644 --- a/bp/blog/routes.py +++ b/bp/blog/routes.py @@ -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 \ No newline at end of file diff --git a/shared b/shared index 9cb8cf9..3823327 160000 --- a/shared +++ b/shared @@ -1 +1 @@ -Subproject commit 9cb8cf9e1d9cc0e016df87c5d3bd4b2c9e022b21 +Subproject commit 38233279a21632709221b3ef466580b10a087d29 diff --git a/templates/_types/blog/_main_panel.html b/templates/_types/blog/_main_panel.html index f1a1f2d..055e164 100644 --- a/templates/_types/blog/_main_panel.html +++ b/templates/_types/blog/_main_panel.html @@ -1,8 +1,8 @@ {# Content type tabs: Posts | Pages #}