From 2407971e81dfd5fb2611ade8d664df832fb7eab2 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 26 Nov 2019 00:06:29 +0100 Subject: [PATCH] consistent slashes in all slugs --- gatsby/createMarkdownFields.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gatsby/createMarkdownFields.js b/gatsby/createMarkdownFields.js index 725d3d40..1803540e 100644 --- a/gatsby/createMarkdownFields.js +++ b/gatsby/createMarkdownFields.js @@ -9,7 +9,7 @@ exports.createMarkdownFields = (node, actions, getNode) => { const parsedFilePath = path.parse(fileNode.relativePath) const slugOriginal = createFilePath({ node, getNode }) - createSlug(node, createNodeField, slugOriginal, parsedFilePath) + createSlug(node, createNodeField, parsedFilePath) createDate(node, createNodeField, slugOriginal) // github file link @@ -24,13 +24,13 @@ exports.createMarkdownFields = (node, actions, getNode) => { }) } -function createSlug(node, createNodeField, slugOriginal, parsedFilePath) { +function createSlug(node, createNodeField, parsedFilePath) { let slug if (parsedFilePath.name === 'index') { slug = `/${parsedFilePath.dir.substring(11)}` // remove date from file dir } else { - slug = `/${slugOriginal.substring(12)}` // remove first slash & date from file path + slug = `/${parsedFilePath.name.substring(11)}` // remove date from file path } createNodeField({