1
Fork 0
mirror of https://github.com/RGBCube/Site synced 2025-07-30 12:37:50 +00:00

treewide: set title from basename if it doesn't exist

This commit is contained in:
RGBCube 2025-06-08 17:58:48 +03:00
parent de33425078
commit bd49960b65
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M
5 changed files with 11 additions and 15 deletions

13
site.ts
View file

@ -40,7 +40,15 @@ site.data("color", color);
site.add(".");
site.process([".html"], (pages) => {
site.preprocess([".html"], (pages) =>
pages.forEach((page) => {
page.data.title = page.data.title ??
page.data.basename
.replace(/-/g, " ")
.replace(/\b\w/g, (char) => char.toUpperCase());
}));
site.process([".html"], (pages) =>
pages.forEach((page) => {
const document = page.document;
@ -156,8 +164,7 @@ site.process([".html"], (pages) => {
footnotes.remove();
}
}
});
});
}));
site.use(extractDate());
site.use(redirects());

View file

@ -1,6 +1,6 @@
{{ function process(entry, toplevel = false) }}
<div class="relative p-4{{ if !toplevel }} my-4 md:mx-8{{ /if }} border-1 bg-white dark:bg-black">
{{ if entry.data.title }}
{{ if entry.data.url }}
<a
class="
reset

View file

@ -1,7 +1,4 @@
---
title: Test
description: "Testing"
draft: true
---

View file

@ -1,7 +1,3 @@
---
title: Analytics
---
This site and other websites under this domain run
[Plausible](https://plausible.io/) analytics on a self-hosted instance at
[shekels.rgbcu.be](https://shekels.rgbcu.be/).

View file

@ -1,7 +1,3 @@
---
title: Availability
---
The website of RGBCube is up.
This webpage is **absolutely never** wrong.