diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 06961a7..6a5b34a 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -12,7 +12,8 @@ interface Props { } let { title, trailingTitle } = Astro.props -if(trailingTitle == null) trailingTitle = 'Solsynth LLC' +if (!trailingTitle) trailingTitle = 'Solsynth LLC' +console.log(title ? `${title} | ${trailingTitle}` : trailingTitle) const locale = Astro.currentLocale ?? 'en' --- diff --git a/src/pages/posts/[...slug].astro b/src/pages/posts/[...slug].astro index 2fff45a..8bcad9b 100644 --- a/src/pages/posts/[...slug].astro +++ b/src/pages/posts/[...slug].astro @@ -13,7 +13,7 @@ import { getAttachmentUrl, fetchAttachmentMeta } from '@/scripts/attachment' const { slug } = Astro.params const baseUrl = import.meta.env.PUBLIC_SOLAR_NETWORK_URL -const resp = await fetch(`${baseUrl}/cgi/co/posts/${slug}`) +const resp = await fetch(`${baseUrl}/cgi/co/posts/${slug?.replace('/', ':')}`) if (resp.status !== 200) { return new Response(null, { status: 404 }) @@ -27,16 +27,27 @@ const rawContent = await marked(data.body.content as string, { const content = sanitizeHtml(rawContent) const attachments = await fetchAttachmentMeta(data.body.attachments) + +const title = data.body?.title ? data.body.title : `Post #${data.id}` +const description = + data.body?.description ?? data.body?.content?.substring(0, 200) + '...' + +const url = + data.alias && data.alias_prefix + ? `https://solsynth.dev/posts/${data.alias_prefix}/${data.alias}` + : `https://solsynth.dev/posts/${data.id}` ---