diff --git a/src/routes/post/[slug]/+page.server.ts b/src/routes/post/[slug]/+page.server.ts index c722c3b..de63baa 100644 --- a/src/routes/post/[slug]/+page.server.ts +++ b/src/routes/post/[slug]/+page.server.ts @@ -76,6 +76,14 @@ export const load: PageServerLoad = async ({ params, locals, url }) => { contentHtml = await processMarkdownHtmlImages(contentHtml); } + let contentHeadlineHtml = ''; + let contentBodyHtml = contentHtml; + const h1Match = contentHtml.match(/^\s*(]*>[\s\S]*?<\/h1>)([\s\S]*)$/); + if (h1Match) { + contentHeadlineHtml = h1Match[1]; + contentBodyHtml = h1Match[2]; + } + const hasRowContent = ((post as { row1Content?: unknown[] }).row1Content?.length ?? 0) > 0 || ((post as { row2Content?: unknown[] }).row2Content?.length ?? 0) > 0 || @@ -199,6 +207,8 @@ export const load: PageServerLoad = async ({ params, locals, url }) => { postImageFocal: postImageField?.focal ?? null, postDate, contentHtml, + contentHeadlineHtml, + contentBodyHtml, hasRowContent, isEvent, eventDateRaw, diff --git a/src/routes/post/[slug]/+page.svelte b/src/routes/post/[slug]/+page.svelte index 9f35efc..a86426e 100644 --- a/src/routes/post/[slug]/+page.svelte +++ b/src/routes/post/[slug]/+page.svelte @@ -32,16 +32,6 @@ {/if} -{#if data.isEvent && (data.eventDateLabel || data.eventLocationText)} -
- -
-{/if} -
{#if data.rawPostImageUrl}
@@ -83,9 +73,23 @@
- {#if data.contentHtml} + {#if data.contentHeadlineHtml}
- {@html data.contentHtml} + {@html data.contentHeadlineHtml} +
+ {/if} + {#if data.isEvent && (data.eventDateLabel || data.eventLocationText)} +
+ +
+ {/if} + {#if data.contentBodyHtml} +
+ {@html data.contentBodyHtml}
{/if} {#if data.hasRowContent}