Deprecate descriptionPlaintext field
This commit is contained in:
parent
a713adc1ec
commit
688f9b982d
27 changed files with 64 additions and 121 deletions
|
|
@ -2,10 +2,10 @@ import rss, { type RSSFeedItem } from "@astrojs/rss";
|
|||
import type { APIRoute } from "astro";
|
||||
import { getCollection, type CollectionEntry } from "astro:content";
|
||||
import sanitizeHtml from "sanitize-html";
|
||||
import { marked } from "marked";
|
||||
import { decode as tinyDecode } from "tiny-decode";
|
||||
import { t } from "../i18n";
|
||||
import type { Lang } from "../content/config";
|
||||
import { markdownToHtml } from "../utils/markdown_to_html";
|
||||
import { markdownToPlaintext } from "../utils/markdown_to_plaintext";
|
||||
|
||||
type FeedItem = RSSFeedItem & {
|
||||
pubDate: Date;
|
||||
|
|
@ -48,7 +48,7 @@ export const GET: APIRoute = async ({ site }) => {
|
|||
pubDate: toNoonUTCDate(data.pubDate!),
|
||||
link: `/stories/${slug}`,
|
||||
description:
|
||||
`${t(data.lang, "story/warnings", data.wordCount, data.contentWarning.trim())} ${data.descriptionPlaintext || data.description}`
|
||||
`${t(data.lang, "story/warnings", data.wordCount, data.contentWarning.trim())}\n\n${markdownToPlaintext(data.description)}`
|
||||
.replaceAll(/[\n ]+/g, " ")
|
||||
.trim(),
|
||||
categories: ["story"],
|
||||
|
|
@ -73,8 +73,8 @@ export const GET: APIRoute = async ({ site }) => {
|
|||
? `<p>${t(data.lang, "export_story/commissioned_by", getLinkForUser(users.find((user) => user.id === data.commissioner!.id)!, data.lang))}</p>`
|
||||
: "") +
|
||||
`<hr><p><em>${t(data.lang, "story/warnings", data.wordCount, data.contentWarning.trim())}</em></p>` +
|
||||
`<hr>${tinyDecode(await marked(body))}` +
|
||||
`<hr>${tinyDecode(await marked(data.description))}`,
|
||||
`<hr>${markdownToHtml(body)}` +
|
||||
`<hr>${markdownToHtml(data.description)}`,
|
||||
),
|
||||
})),
|
||||
),
|
||||
|
|
@ -84,7 +84,7 @@ export const GET: APIRoute = async ({ site }) => {
|
|||
pubDate: toNoonUTCDate(data.pubDate!),
|
||||
link: `/games/${slug}`,
|
||||
description:
|
||||
`${t(data.lang, "game/warnings", data.platforms, data.contentWarning)} ${data.descriptionPlaintext || data.description}`
|
||||
`${t(data.lang, "game/warnings", data.platforms, data.contentWarning)}\n\n${markdownToPlaintext(data.description)}`
|
||||
.replaceAll(/[\n ]+/g, " ")
|
||||
.trim(),
|
||||
categories: ["game"],
|
||||
|
|
@ -104,8 +104,8 @@ export const GET: APIRoute = async ({ site }) => {
|
|||
)}</p>` +
|
||||
`<hr><p>${t(data.lang, "game/platforms", data.platforms)}</p>` +
|
||||
`<hr><p><em>${data.contentWarning.trim()}</em></p>` +
|
||||
`<hr>${tinyDecode(marked.parse(body) as string)}` +
|
||||
`<hr>${tinyDecode(marked.parse(data.description) as string)}`,
|
||||
`<hr>${markdownToHtml(body)}` +
|
||||
`<hr>${markdownToHtml(data.description)}`,
|
||||
),
|
||||
})),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue