Improve age-restricted hyperlinks, clean up markup, and add navigation icons

This commit is contained in:
Bad Manners 2024-08-25 16:18:13 -03:00
parent c55c82633d
commit 57c2c7c649
31 changed files with 279 additions and 138 deletions

View file

@ -1,9 +1,9 @@
import type { APIRoute, GetStaticPaths } from "astro";
import { APACHE_CONFIG } from "astro:env/server";
const htaccess = `
const htaccess = String.raw`
ErrorDocument 404 /404.html
RedirectMatch 301 ^/stories(\/(index.html)?)?$ /stories/1/
RedirectMatch 301 ^/stories(/(index.html)?)?$ /stories/1/
Redirect 301 /story/ /stories/
Redirect 301 /game/ /games/
`.trim();

View file

@ -90,9 +90,9 @@ export const GET: APIRoute<Props, Params> = async ({ props: { story }, site }) =
}, Promise.resolve(""));
switch (exportFormat) {
case "bbcode":
return { exportWebsite, description: 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 { exportWebsite, description: storyDescription.replaceAll(/\n\n\n+/g, "\n\n").trim() };
return { descriptionFilename: `description_${exportWebsite}.md`, descriptionText: storyDescription.replaceAll(/\n\n\n+/g, "\n\n").trim() };
default:
const unknown: never = exportFormat;
throw new Error(`Unknown export format "${unknown}"`);
@ -131,10 +131,10 @@ export const GET: APIRoute<Props, Params> = async ({ props: { story }, site }) =
story: storyText,
description: description.reduce(
(acc, item) => {
acc[item.exportWebsite] = item.description;
acc[item.descriptionFilename] = item.descriptionText;
return acc;
},
{} as Record<PostWebsite, string>,
{} as Record<string, string>,
),
thumbnail: story.data.thumbnail ? story.data.thumbnail.src : null,
}),

View file

@ -90,7 +90,9 @@ const latestItems: LatestItemsEntry[] = await Promise.all(
For more information about me, please check out <a
class="text-link underline"
href="https://badmanners.xyz/"
target="_blank">my main website</a
data-age-restricted
rel="me"
>my main website</a
>.
</p>
</div>

View file

@ -44,7 +44,7 @@ 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" 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>
)
@ -69,7 +69,7 @@ const totalPages = Math.ceil(page.total / page.size);
}
{
page.url.next && (
<a class="text-link px-2 py-1 underline" href={page.url.next}>
<a class="text-link px-2 py-1 underline" rel="next" href={page.url.next}>
Next page
</a>
)
@ -129,7 +129,7 @@ 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" 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>
)
@ -154,7 +154,7 @@ const totalPages = Math.ceil(page.total / page.size);
}
{
page.url.next && (
<a class="text-link px-2 py-1 underline" href={page.url.next}>
<a class="text-link px-2 py-1 underline" rel="next" href={page.url.next}>
Next page
</a>
)