mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-25 19:53:21 +02:00
Update slug format for post type
Posts no longer need to specify a full url for the resulting html. Rather, the prefix portion of the url will be inferred from the post's location in the source filesystem. The post slug now simply represents a url friendly version of the title. Additionally, updates all sample posts to use the new slug format.
This commit is contained in:
@@ -8,10 +8,11 @@ const onCreateNode = ({ node, actions, getNode }) => {
|
||||
|
||||
if (node.internal.type === 'MarkdownRemark') {
|
||||
if (typeof node.frontmatter.slug !== 'undefined') {
|
||||
const dirname = getNode(node.parent).relativeDirectory;
|
||||
createNodeField({
|
||||
node,
|
||||
name: 'slug',
|
||||
value: node.frontmatter.slug
|
||||
value: `/${dirname}/${node.frontmatter.slug}`
|
||||
});
|
||||
} else {
|
||||
const value = createFilePath({ node, getNode });
|
||||
|
Reference in New Issue
Block a user