fix(daily-email): remove newlines in slugs
Fix page not found error when adding a permalink in this format: ```yaml --- permalink: > archive/2022/10/20/cherry-picking-commits-is-an-anti-pattern ``` This causes a newline character to be added to the end of the permalink, and causes the previous code to not be able to match the slug for the filename based on the `permalink` value within the front matter.
This commit is contained in:
parent
6be23267c0
commit
a56e326a57
|
@ -5,14 +5,18 @@ import Layout from '../../layouts/DailyEmailLayout.astro'
|
|||
export async function getStaticPaths() {
|
||||
const emails = await Astro.glob('../../daily-emails/*.md')
|
||||
|
||||
return emails.map(email => ({
|
||||
params: {
|
||||
slug: email.frontmatter.permalink.replace('archive/', ''),
|
||||
},
|
||||
props: {
|
||||
email,
|
||||
return emails.map(email => {
|
||||
return {
|
||||
params: {
|
||||
slug: email.frontmatter.permalink
|
||||
.replace('archive/', '')
|
||||
.replace('\n', ''),
|
||||
},
|
||||
props: {
|
||||
email,
|
||||
}
|
||||
}
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
const { Content } = Astro.props.email
|
||||
|
|
Loading…
Reference in a new issue