Update RSS elements and TOC svg

This commit is contained in:
thiloho
2025-04-27 00:01:26 +02:00
parent 480ddd1e68
commit 89e5dbf5ec
6 changed files with 32 additions and 158 deletions

11
src/pages/404.astro Normal file
View File

@@ -0,0 +1,11 @@
---
import PageLayout from "../layouts/PageLayout.astro";
---
<PageLayout title="404: Not found" description="Not found">
<p>
The file associated with the requested path (<code
>{Astro.originPathname}</code
>) could not be found.
</p>
</PageLayout>

View File

@@ -30,18 +30,17 @@ const { Content, headings } = await render(article);
<details class="toc sticky top-0 z-20">
<summary
title="Table of contents"
class="flex mx-auto w-fit cursor-pointer list-none p-2 border-b-2 border-transparent hover:bg-neutral-200 hover:border-neutral-400 hover:dark:bg-neutral-700 hover:dark:border-neutral-600"
class="flex mx-auto w-fit cursor-pointer list-none px-2 py-2.5 border-b-2 border-transparent hover:bg-neutral-200 hover:border-neutral-400 hover:dark:bg-neutral-700 hover:dark:border-neutral-600"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
viewBox="0 0 20 20"
fill="currentColor"
class="size-6"
class="size-5"
>
<path
fill-rule="evenodd"
d="M2.25 4.5A.75.75 0 0 1 3 3.75h14.25a.75.75 0 0 1 0 1.5H3a.75.75 0 0 1-.75-.75Zm0 4.5A.75.75 0 0 1 3 8.25h9.75a.75.75 0 0 1 0 1.5H3A.75.75 0 0 1 2.25 9Zm15-.75A.75.75 0 0 1 18 9v10.19l2.47-2.47a.75.75 0 1 1 1.06 1.06l-3.75 3.75a.75.75 0 0 1-1.06 0l-3.75-3.75a.75.75 0 1 1 1.06-1.06l2.47 2.47V9a.75.75 0 0 1 .75-.75Zm-15 5.25a.75.75 0 0 1 .75-.75h9.75a.75.75 0 0 1 0 1.5H3a.75.75 0 0 1-.75-.75Z"
clip-rule="evenodd"></path>
d="M10.75 16.82A7.462 7.462 0 0 1 15 15.5c.71 0 1.396.098 2.046.282A.75.75 0 0 0 18 15.06v-11a.75.75 0 0 0-.546-.721A9.006 9.006 0 0 0 15 3a8.963 8.963 0 0 0-4.25 1.065V16.82ZM9.25 4.065A8.963 8.963 0 0 0 5 3c-.85 0-1.673.118-2.454.339A.75.75 0 0 0 2 4.06v11a.75.75 0 0 0 .954.721A7.506 7.506 0 0 1 5 15.5c1.579 0 3.042.487 4.25 1.32V4.065Z"
></path>
</svg>
</summary>
<div

View File

@@ -13,7 +13,7 @@ const sortedArticles = allArticles.sort((a, b) => {
<ul>
{
sortedArticles.map((article) => (
<li class="flex gap-2">
<li>
<Date date={article.data.pubDate} />
<span>&raquo;</span>
<a

View File

@@ -1,7 +0,0 @@
---
import PageLayout from "../layouts/PageLayout.astro";
---
<PageLayout title="Contact" description="Contact">
<p>Example content</p>
</PageLayout>

View File

@@ -6,12 +6,24 @@ const parser = new MarkdownIt();
export const GET = async (context) => {
const blog = await getCollection("blog");
const latestModDate = blog.reduce((latest, article) => {
const modDate = article.data.modDate || article.data.pubDate;
return modDate > latest ? modDate : latest;
}, new Date(0));
return rss({
title: "Thilo Hohlts Blog",
description: "Thilo Hohlts Blog",
title: "Thilo Hohlt's Blog",
description: "Thilo Hohlt's Blog",
site: context.site,
trailingSlash: false,
stylesheet: "pretty-feed-v3.xsl",
xmlns: {
atom: "http://www.w3.org/2005/Atom",
},
customData: `
<lastBuildDate>${latestModDate.toUTCString()}</lastBuildDate>
<atom:link href="${context.site}rss.xml" rel="self" type="application/rss+xml" />
`,
items: blog.map((article) => ({
link: `/blog/${article.id}/`,
content: sanitizeHtml(parser.render(article.body), {