fix: ensure that the slug is a string

Ensure that the last part of the permalink is used as the slug.
This commit is contained in:
Oliver Davies 2022-12-11 00:39:51 +00:00
parent 991c333c8a
commit 4161ecbe7c

View file

@ -11,13 +11,13 @@ export async function getStaticPaths() {
const slug = email.frontmatter.permalink
.replace('archive/', '')
.replace('\n', '')
.split('/')[3] as string
const slugParts = slug.split('/')
return {
params: {
day: pubDate[2],
month: pubDate[1],
slug,
slug: slugParts.reverse()[0],
year: pubDate[0],
},
props: {