From 7c4f2964eba784f7cff91754045b8dd4281be79e Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Tue, 26 May 2026 22:16:21 -0400 Subject: [PATCH] Render frontmatter as styled cards in public share view Split search query tokens on word boundaries for accurate inverted-index matching --- backend/main.py | 27 ++++++++++++++++++++++++++- backend/search.py | 24 +++++++++++++++--------- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/backend/main.py b/backend/main.py index bbc0637..c4661e8 100644 --- a/backend/main.py +++ b/backend/main.py @@ -2866,6 +2866,25 @@ async def public_share_view(token: str): post = parse_markdown_file(raw) html = _render_markdown(post.content, share["vault"], file_path) title = post.metadata.get("title", file_path.stem) + + # Build frontmatter section HTML + fm_html = "" + if post.metadata: + fm_items = [] + skip_keys = {"title", "titre"} + for k, v in post.metadata.items(): + if k in skip_keys: + continue + if isinstance(v, list): + v = ", ".join(str(x) for x in v) + elif isinstance(v, bool): + v = "✓" if v else "✗" + elif v is None: + v = "—" + fm_items.append(f'
{k}{v}
') + if fm_items: + fm_html = f'
Frontmatter
{"".join(fm_items)}
' + return HTMLResponse(f""" {title} — ObsiGate Share