1
0
mirror of https://github.com/kremalicious/gatsby-redirect-from.git synced 2024-12-22 09:13:20 +01:00

Update gatsby-node.js to use slug from frontmatter (#448)

update line 65 : the previous code did not use slug to set _slug variable. So the frontmatter slug value was not used even if it was set
This commit is contained in:
Sylvain BRUAS 2024-06-07 15:43:42 +02:00 committed by GitHub
parent c2914069da
commit 169ea1fed0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,7 +62,7 @@ export async function createPages({ graphql, actions }, pluginOptions) {
allPosts.forEach(({ node }) => { allPosts.forEach(({ node }) => {
let _slug let _slug
const { redirect_from, slug } = node.frontmatter const { redirect_from, slug } = node.frontmatter
if (!slug) _slug = node.fields?.slug _slug = slug || node.fields?.slug;
if (!_slug) { if (!_slug) {
console.log( console.log(
'%c %s %c %s', '%c %s %c %s',