Wire sx_content through full read/write pipeline
Model: add sx_content column to Post. Writer: accept sx_content in create_post, create_page, update_post. Routes: read sx_content from form data in new post, new page, and edit routes. Read pipeline: ghost_db includes sx_content in public dict, detail/home views prefer sx_content over html when available, PostDTO includes sx_content. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -25,13 +25,15 @@
|
||||
excerpt
|
||||
(div :class "hidden md:block" at-bar)))
|
||||
|
||||
(defcomp ~blog-detail-main (&key draft chrome feature-image html-content)
|
||||
(defcomp ~blog-detail-main (&key draft chrome feature-image html-content sx-content)
|
||||
(<> (article :class "relative"
|
||||
draft
|
||||
chrome
|
||||
(when feature-image (div :class "mb-3 flex justify-center"
|
||||
(img :src feature-image :alt "" :class "rounded-lg w-full md:w-3/4 object-cover")))
|
||||
(when html-content (div :class "blog-content p-2" (~rich-text :html html-content))))
|
||||
(if sx-content
|
||||
(div :class "blog-content p-2" sx-content)
|
||||
(when html-content (div :class "blog-content p-2" (~rich-text :html html-content)))))
|
||||
(div :class "pb-8")))
|
||||
|
||||
(defcomp ~blog-meta (&key robots page-title desc canonical og-type og-title image twitter-card twitter-title)
|
||||
@@ -50,5 +52,8 @@
|
||||
(meta :name "twitter:description" :content desc)
|
||||
(when image (meta :name "twitter:image" :content image))))
|
||||
|
||||
(defcomp ~blog-home-main (&key html-content)
|
||||
(article :class "relative" (div :class "blog-content p-2" (~rich-text :html html-content))))
|
||||
(defcomp ~blog-home-main (&key html-content sx-content)
|
||||
(article :class "relative"
|
||||
(if sx-content
|
||||
(div :class "blog-content p-2" sx-content)
|
||||
(div :class "blog-content p-2" (~rich-text :html html-content)))))
|
||||
|
||||
@@ -716,11 +716,13 @@ def _post_main_panel_sx(ctx: dict) -> str:
|
||||
|
||||
fi = post.get("feature_image")
|
||||
html_content = post.get("html", "")
|
||||
sx_content = post.get("sx_content", "")
|
||||
|
||||
return sx_call("blog-detail-main",
|
||||
draft=SxExpr(draft_sx) if draft_sx else None,
|
||||
chrome=SxExpr(chrome_sx) if chrome_sx else None,
|
||||
feature_image=fi, html_content=html_content,
|
||||
sx_content=SxExpr(sx_content) if sx_content else None,
|
||||
)
|
||||
|
||||
|
||||
@@ -770,10 +772,13 @@ def _post_meta_sx(ctx: dict) -> str:
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def _home_main_panel_sx(ctx: dict) -> str:
|
||||
"""Home page content — renders the Ghost page HTML."""
|
||||
"""Home page content — renders the Ghost page HTML or sx_content."""
|
||||
post = ctx.get("post") or {}
|
||||
html = post.get("html", "")
|
||||
return sx_call("blog-home-main", html_content=html)
|
||||
sx_content = post.get("sx_content", "")
|
||||
return sx_call("blog-home-main",
|
||||
html_content=html,
|
||||
sx_content=SxExpr(sx_content) if sx_content else None)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user