Use a more robust slugify function

This commit is contained in:
thiloho
2024-09-13 19:30:56 +02:00
parent db8b284d6f
commit 79d1c9f5c7
6 changed files with 25 additions and 53 deletions

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import type { WebsiteOverview } from "../../utils";
import { type WebsiteOverview, slugify } from "../../utils";
import type { Article } from "../../db-schema";
const {
@@ -60,9 +60,8 @@
<strong>{key}</strong>
<ul>
{#each categorizedArticles[key] as { title }}
{@const articleFileName = title.toLowerCase().split(" ").join("-")}
<li>
<a href="{isIndexPage ? './articles' : '.'}/{articleFileName}">{title}</a>
<a href="{isIndexPage ? './articles' : '.'}/{slugify(title)}">{title}</a>
</li>
{/each}
</ul>