Improve HTML rendering in Markdown and update layouts

This commit is contained in:
Bad Manners 2024-08-26 12:54:24 -03:00
parent 4194154818
commit 21a77ed254
40 changed files with 282 additions and 176 deletions

View file

@ -3,7 +3,7 @@ import GalleryLayout from "../layouts/GalleryLayout.astro";
---
<GalleryLayout pageTitle="404">
<meta slot="head-description" property="og:description" content="Not found" />
<meta slot="head" property="og:description" content="Not found" />
<h1 class="m-2 text-2xl font-semibold text-stone-800 dark:text-stone-100">404 &ndash; Not Found</h1>
<p class="my-4">The requested link couldn't be found. Make sure that the URL is correct.</p>
</GalleryLayout>

View file

@ -8,6 +8,7 @@ import { getUsernameForLang } from "../../../utils/get_username_for_lang";
import { isAnonymousUser } from "../../../utils/is_anonymous_user";
import { qualifyLocalURLsInMarkdown } from "../../../utils/qualify_local_urls_in_markdown";
import { getWebsiteLinkForUser } from "../../../utils/get_website_link_for_user";
import { toPlainMarkdown } from "../../../utils/to_plain_markdown";
interface ExportWebsiteInfo {
website: PostWebsite;
@ -86,13 +87,19 @@ export const GET: APIRoute<Props, Params> = async ({ props: { story }, site }) =
}
const acc = await promise;
const newData = await qualifyLocalURLsInMarkdown(data, lang, site, exportWebsite);
return acc ? `${acc}\n\n${newData}` : newData;
return `${acc}\n\n${newData}`;
}, Promise.resolve(""));
switch (exportFormat) {
case "bbcode":
return { descriptionFilename: `description_${exportWebsite}.txt`, descriptionText: markdownToBbcode(storyDescription).replaceAll(/\n\n\n+/g, "\n\n") };
return {
descriptionFilename: `description_${exportWebsite}.txt`,
descriptionText: markdownToBbcode(storyDescription).replaceAll(/\n\n\n+/g, "\n\n"),
};
case "markdown":
return { descriptionFilename: `description_${exportWebsite}.md`, descriptionText: storyDescription.replaceAll(/\n\n\n+/g, "\n\n").trim() };
return {
descriptionFilename: `description_${exportWebsite}.md`,
descriptionText: toPlainMarkdown(storyDescription).replaceAll(/\n\n\n+/g, "\n\n").trim(),
};
default:
const unknown: never = exportFormat;
throw new Error(`Unknown export format "${unknown}"`);

View file

@ -18,7 +18,7 @@ const games = await Promise.all(
---
<GalleryLayout pageTitle="Games" class="h-feed">
<meta slot="head-description" property="og:description" content="Bad Manners || A game that I've gone and done." />
<meta slot="head" property="og:description" content="Bad Manners || A game that I've gone and done." />
<h1 class="p-name m-2 text-2xl font-semibold text-stone-800 dark:text-stone-100">Games</h1>
<p class="p-summary my-4">A game that I've gone and done.</p>
<ul class="my-6 flex flex-wrap items-start justify-center gap-4 text-center md:justify-normal">

View file

@ -74,7 +74,7 @@ const latestItems: LatestItemsEntry[] = await Promise.all(
---
<GalleryLayout pageTitle="Gallery" class="h-feed">
<meta slot="head-description" property="og:description" content="Bad Manners || Welcome to my gallery!" />
<meta slot="head" property="og:description" content="Bad Manners || Welcome to my gallery!" />
<h1 class="p-name m-2 text-2xl font-semibold text-stone-800 dark:text-stone-100">My gallery</h1>
<div class="p-summary">
<p class="my-4">
@ -91,8 +91,7 @@ const latestItems: LatestItemsEntry[] = await Promise.all(
class="text-link underline"
href="https://badmanners.xyz/"
data-age-restricted
rel="me"
>my main website</a
rel="me">my main website</a
>.
</p>
</div>

View file

@ -4,7 +4,7 @@ import GalleryLayout from "../layouts/GalleryLayout.astro";
---
<GalleryLayout pageTitle="Search">
<meta slot="head-description" property="og:description" content="Bad Manners || Search" />
<meta slot="head" property="og:description" content="Bad Manners || Search" />
<h1 class="m-2 text-2xl font-semibold text-stone-800 dark:text-stone-100">Search</h1>
<SearchComponent id="search" className="pagefind-ui my-4" />
</GalleryLayout>

View file

@ -29,7 +29,7 @@ const totalPages = Math.ceil(page.total / page.size);
---
<GalleryLayout pageTitle="Stories" class="h-feed">
<meta slot="head-description" property="og:description" content={`Bad Manners || ${page.total} stories.`} />
<meta slot="head" property="og:description" content={`Bad Manners || ${page.total} stories.`} />
<h1 class="p-name m-2 text-2xl font-semibold text-stone-800 dark:text-stone-100">Stories</h1>
<div class="p-summary">
<p class="my-4">The bulk of my content!</p>
@ -44,7 +44,11 @@ const totalPages = Math.ceil(page.total / page.size);
<div class="mx-auto mb-6 mt-2 flex w-fit rounded-lg border border-stone-400 dark:border-stone-500">
{
page.url.prev && (
<a class="text-link border-r border-stone-400 px-2 py-1 underline dark:border-stone-500" rel="prev" href={page.url.prev}>
<a
class="text-link border-r border-stone-400 px-2 py-1 underline dark:border-stone-500"
rel="prev"
href={page.url.prev}
>
Previous page
</a>
)
@ -129,7 +133,11 @@ const totalPages = Math.ceil(page.total / page.size);
<div class="mx-auto my-6 flex w-fit rounded-lg border border-stone-400 dark:border-stone-500">
{
page.url.prev && (
<a class="text-link border-r border-stone-400 px-2 py-1 underline dark:border-stone-500" rel="prev" href={page.url.prev}>
<a
class="text-link border-r border-stone-400 px-2 py-1 underline dark:border-stone-500"
rel="prev"
href={page.url.prev}
>
Previous page
</a>
)

View file

@ -22,7 +22,7 @@ const mainChaptersWithSummaries = mainChapters.filter((story) => story.data.summ
<GalleryLayout pageTitle={series.data.name} enablePagefind={true} class="h-feed">
<meta
slot="head-description"
slot="head"
property="og:description"
content="The Lost of the Marshes || The story of Quince, Nikili, and Suu."
/>
@ -123,7 +123,7 @@ const mainChaptersWithSummaries = mainChapters.filter((story) => story.data.summ
<Image
class="mx-auto w-full max-w-4xl break-before-page"
src={mapImage}
alt="A geopolitical map for the setting of The Lost of the Marshes"
alt="A geopolitical map for the setting of The Lost of the Marshes. The center is covered by desert plains, except for two rivers that run from north to south through the marshes: the First River to the west, and the Second River to the East. The First River starts at the Eastern Toroza Mountains, passing through the Labla state before reaching the Quuwa Marshes inside of Kaati. Along the way, it passes next to the cities of Kaati to its east and Fereh to its west, respectively. The Second River passes by Sinipin to its west. South of the Quuwa marshes and between both rivers are Logas to the east and Kuir to the west, until both rivers reach the Hamora Lake inside of the Hamora Marshes. To the north of the lake is Zugul, and out of the lake comes the southeastern-bound Last River. Halfway down the Last River is Kyorna to the northwest, before it eventually reaches the Bronze Gulf. To the east of the Kaati state is Zuit on the Szogors Mountains, including Saisa; to the south is the state of Munigad; and to the west, an empty desert called Fool's Hope."
data-pagefind-meta="image[src],image_alt[alt]"
/>
</section>

View file

@ -72,7 +72,7 @@ if (uncategorizedTagsSet.size > 0) {
<GalleryLayout pageTitle="Tags">
<meta
property="og:description"
slot="head-description"
slot="head"
content="Bad Manners || Find all content with a specific tag."
/>
<h1 class="m-2 text-2xl font-semibold text-stone-800 dark:text-stone-100">All available tags</h1>

View file

@ -22,7 +22,10 @@ const { badTag } = Astro.props;
---
<GalleryLayout pageTitle={`Works tagged "${badTag}"`}>
<meta slot="head-description" content="No." property="og:description" />
<Fragment slot="head">
<meta content="No." property="og:description" />
<meta name="robots" content="noindex" />
</Fragment>
<h1 class="m-2 text-2xl font-semibold text-stone-800 dark:text-stone-100">Works tagged "{badTag}"</h1>
<p class="my-4">No.</p>
</GalleryLayout>

View file

@ -121,7 +121,7 @@ const totalWorksWithTag = t(
<GalleryLayout pageTitle={`Works tagged "${props.tag}"`}>
<meta
slot="head-description"
slot="head"
content={`Bad Manners || ${totalWorksWithTag || props.tag}`}
property="og:description"
/>