Rename slug field

This commit is contained in:
alxshelepenok 2018-11-12 20:38:36 +03:00
parent 913da4453b
commit fb5f9c89fc
3 changed files with 5 additions and 4 deletions

View File

@ -1,7 +1,7 @@
--- ---
title: "About me" title: "About me"
slug: "/about"
template: "page" template: "page"
slug: "/about"
--- ---
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante.

View File

@ -1,7 +1,7 @@
--- ---
title: "Contact me" title: "Contact me"
slug: "/contact"
template: "page" template: "page"
slug: "/contacts"
--- ---
Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat. Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.

View File

@ -10,7 +10,8 @@ const onCreateNode = ({ node, actions, getNode }) => {
fmImagesToRelative(node); fmImagesToRelative(node);
if (node.internal.type === 'MarkdownRemark') { if (node.internal.type === 'MarkdownRemark') {
if (typeof node.frontmatter.path !== 'undefined') { console.log(node.frontmatter);
if (typeof node.frontmatter.slug !== 'undefined') {
createNodeField({ createNodeField({
node, node,
name: 'slug', name: 'slug',