chore: more consistent slugging
This commit is contained in:
parent
ae13df9813
commit
a18d0049ba
9 changed files with 15 additions and 18 deletions
|
@ -1,6 +1,4 @@
|
|||
import { createClient } from '@supabase/supabase-js'
|
||||
import { DateTime } from 'luxon'
|
||||
import slugify from 'slugify'
|
||||
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL
|
||||
const SUPABASE_KEY = process.env.SUPABASE_KEY
|
||||
|
@ -81,11 +79,6 @@ const fetchAllPosts = async () => {
|
|||
for (const post of data) {
|
||||
post.tags = await fetchTagsForPost(post.id)
|
||||
post.blocks = await fetchBlocksForPost(post.id)
|
||||
post.url = `/posts/${DateTime.fromISO(post.date).year}/${slugify(post.title, {
|
||||
replacement: '-',
|
||||
remove: /[#,&,+()$~%.'":*?<>{}\[\]\/\\|`!@\^\—]/g,
|
||||
lower: true,
|
||||
})}/`
|
||||
}
|
||||
|
||||
posts = posts.concat(data)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
{{ post.date | date: "%B %e, %Y" }}
|
||||
</time>
|
||||
</div>
|
||||
<a href="{{ post.url }}">
|
||||
<a href="{{ post.slug }}">
|
||||
<h2 class="flex-centered">{{ post.title }}</h2>
|
||||
</a>
|
||||
<span class="p-author h-card hidden">{{ meta.siteName }}</span>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<ul class="link-list">
|
||||
{% for post in postData limit: 5 %}
|
||||
<li>
|
||||
<a class="no-underline" href="{{ post.url }}" title="{{ post.title | escape}}">
|
||||
<a class="no-underline" href="{{ post.slug }}" title="{{ post.title | escape}}">
|
||||
{{ post.title }}
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -16,7 +16,7 @@ permalink: "/posts/{% if pagination.pageNumber > 0 %}{{ pagination.pageNumber }}
|
|||
{{ post.date | date: "%B %e, %Y" }}
|
||||
</time>
|
||||
</div>
|
||||
<a href="{{ post.url }}">
|
||||
<a href="{{ post.slug }}">
|
||||
<h2 class="flex-centered">{{ post.title }}</h2>
|
||||
</a>
|
||||
<span class="p-author h-card hidden">{{ meta.siteName }}</span>
|
||||
|
|
|
@ -4,10 +4,10 @@ pagination:
|
|||
data: posts
|
||||
size: 1
|
||||
alias: post
|
||||
permalink: "/posts/{{ post.date | date: '%Y' }}/{{ post.title | slugifyPost }}/index.html"
|
||||
permalink: "{{ post.slug }}/index.html"
|
||||
schema: blog
|
||||
---
|
||||
{%- capture postUrl %}{{ meta.url }}{{ post.url }}{% endcapture -%}
|
||||
{%- capture postUrl %}{{ meta.url }}{{ post.slug }}{% endcapture -%}
|
||||
<article class="h-entry">
|
||||
<div class="flex-centered gap-xs icon-small icon-light">
|
||||
{% tablericon "calendar-month" "Date" %}
|
||||
|
|
Reference in a new issue