--- export const prerender = false import sanitizeHtml from 'sanitize-html' import { Icon } from 'astro-icon/components' import {SEO} from 'astro-seo' import { marked } from 'marked' import Layout from '@/layouts/Layout.astro' import AttachmentRenderer from '@/components/AttachmentRenderer.astro' 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}`) if (resp.status !== 200) { return new Response(null, { status: 404 }) } const data = await resp.json() const rawContent = await marked(data.body.content as string, { breaks: data.type == 'story', }) const content = sanitizeHtml(rawContent) const attachments = await fetchAttachmentMeta(data.body.attachments) --- a.mimetype.startsWith('image'))?.rid), url: `https://solsynth.dev/posts/${data.id}` }, article: { publishedTime: new Date(data.created_at).toISOString(), modifiedTime: new Date(data.updated_at).toISOString(), authors: ["@"+data.publisher.name], } }} twitter={{ card: "summary_large_image", title: data.body?.title ? data.body.title : `Post #${data.id}`, description: data.body?.content, creator: "@"+data.publisher.name, image: data.body?.thumbnail ? getAttachmentUrl(data.body.thumbnail) : getAttachmentUrl(attachments.find(a => a.mimetype.startsWith('image'))?.rid), }} />
avatar
{data.publisher.nick} @{data.publisher.name} {data.publisher.description}
{ data.repost_id && ( ) }
{ attachments && (
= 2 ? 'md:grid-cols-2' : 'md:grid-cols-1' } > {attachments.map((attachment) => (
))}
) }