mirror of
https://github.com/thiloho/thiloho.github.io.git
synced 2025-11-22 02:11:35 +01:00
Set site url and remove old logic
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { defineConfig } from "astro/config";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
import { remarkModifiedTime } from "./remark-modified-time.mjs";
|
||||
|
||||
export default defineConfig({
|
||||
site: "https://thiloho.github.io",
|
||||
|
||||
prefetch: {
|
||||
prefetchAll: true,
|
||||
},
|
||||
@@ -15,6 +16,5 @@ export default defineConfig({
|
||||
shikiConfig: {
|
||||
theme: "github-dark",
|
||||
},
|
||||
remarkPlugins: [remarkModifiedTime],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { execSync } from "child_process";
|
||||
|
||||
export const remarkModifiedTime = () => {
|
||||
return (file) => {
|
||||
const filepath = file.history[0];
|
||||
const result = execSync(`git log -1 --pretty="format:%cI" "${filepath}"`);
|
||||
file.data.astro.frontmatter.lastModified = result.toString();
|
||||
};
|
||||
}
|
||||
@@ -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 datetime={date.toISOString()}>
|
||||
{
|
||||
date.toLocaleString("en-us", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
})
|
||||
}
|
||||
</time>
|
||||
@@ -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>
|
||||
) : (
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user