Set site url and remove old logic

This commit is contained in:
thiloho
2025-04-26 09:57:29 +02:00
parent f8e71fc3b6
commit 4f15486742
6 changed files with 16 additions and 36 deletions

View File

@@ -1,29 +1,17 @@
---
interface Props {
date: Date | string;
date: Date;
}
const { date } = Astro.props;
const isStringDate = typeof date === "string";
const transformedDate = isStringDate ? new Date(date) : date;
// Create the base options object
const localeOptions = {
year: "numeric",
month: "long",
day: "numeric",
};
// Conditionally add time options if it's a string date
if (isStringDate) {
Object.assign(localeOptions, {
hour: "2-digit",
minute: "2-digit"
});
}
---
<time datetime={transformedDate.toISOString()}>
{transformedDate.toLocaleString("en-us", localeOptions)}
</time>
<time datetime={date.toISOString()}>
{
date.toLocaleString("en-us", {
year: "numeric",
month: "long",
day: "numeric",
})
}
</time>

View File

@@ -22,7 +22,7 @@ const { title, pubDate, modDate } = Astro.props;
Published: <Date date={pubDate} />
<br />
Last modified:{" "}
{modDate ? <Date date={modDate} /> : <span>No changes yet</span>}
{modDate ? <Date date={modDate} /> : <span>No modifications</span>}
</p>
</hgroup>
) : (

View File

@@ -3,6 +3,7 @@ id: 2
title: "Privacy-focused operating systems"
description: "Good choices for privacy-focused operating systems for desktop and mobile phones."
pubDate: "2025-01-16"
modDate: "2025-04-26"
---
## Introduction

View File

@@ -17,14 +17,14 @@ if (!article) {
throw new Error();
}
const { Content, headings, remarkPluginFrontmatter } = await render(article);
const { Content, headings } = await render(article);
---
<PageLayout
title={article.data.title}
metaDescription="Blog"
pubDate={article.data.pubDate}
modDate={remarkPluginFrontmatter.lastModified}
modDate={article.data.modDate}
>
<details class="toc sticky top-0 z-20">
<summary