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:
parent
991c333c8a
commit
4161ecbe7c
|
@ -11,13 +11,13 @@ export async function getStaticPaths() {
|
||||||
const slug = email.frontmatter.permalink
|
const slug = email.frontmatter.permalink
|
||||||
.replace('archive/', '')
|
.replace('archive/', '')
|
||||||
.replace('\n', '')
|
.replace('\n', '')
|
||||||
.split('/')[3] as string
|
const slugParts = slug.split('/')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
params: {
|
params: {
|
||||||
day: pubDate[2],
|
day: pubDate[2],
|
||||||
month: pubDate[1],
|
month: pubDate[1],
|
||||||
slug,
|
slug: slugParts.reverse()[0],
|
||||||
year: pubDate[0],
|
year: pubDate[0],
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|
Loading…
Reference in a new issue