Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 6x 63x 16x | import type { Entry } from "@joinery/content";
import type { Page } from "../../shared/types/Page";
import { type Origins, toArticleBody } from "./articleBody";
export const toPermalink = (slug: string, siteUrl: string): string =>
new URL(`${slug}/`, siteUrl.endsWith("/") ? siteUrl : `${siteUrl}/`).href;
export const toPage = (entry: Entry, origins: Origins): Page => ({
id: entry.id,
slug: entry.slug,
title: entry.title,
body: toArticleBody(entry.body.value, origins),
seo: entry.seo,
permalink: toPermalink(entry.slug, origins.siteUrl),
});
|