// The post page's SSR payload: the post with its body sanitized, without the // raw `content` source or `translations`, and with related posts as list // rows. Kept apart from view.ts because it loads the sanitizer, which list // pages and cards do not need. import { sanitizeJournalHtml } from './htmlGate.ts' import type { JournalPostDetail } from './types.ts' import { toListPost } from './view.ts' /** A post page's data: the post with its body sanitized and no source or translations. */ export type JournalPostView = JournalPostDetail export function toPostView(post: JournalPostDetail): JournalPostView { return { ...post, content: null, translations: null, content_html: sanitizeJournalHtml(post.content_html), related_posts: (post.related_posts ?? []).map(toListPost), } }