Skip to content

Commit

Permalink
Fixed package import mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-blunden committed Jun 25, 2019
1 parent 04aa6f4 commit 4359af4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions website/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const _ = require('lodash')
const parseFilePath = require('parse-filepath')
const path = require('path')
import slugify from 'slugify'
const slugify = require('slugify')

exports.createPages = ({ actions, graphql }) => {
const { createPage } = actions
Expand Down Expand Up @@ -98,13 +98,13 @@ exports.onCreateNode = ({ node, actions, getNode }) => {
if (fileNode.relativePath) {
const parsedFilePath = parseFilePath(fileNode.relativePath)
const name = node.frontmatter.title
const slug = slugify(name)
const slugified = slugify(name)
if (parsedFilePath.name !== `index` && parsedFilePath.dirname !== '' && !node.frontmatter.permalink) {
slug = `/${parsedFilePath.dirname}/${slug}/`
slug = `/${parsedFilePath.dirname}/${slugified}/`
} else if (parsedFilePath.name !== `index` && node.frontmatter.slug && !node.frontmatter.permalink) {
slug = `${node.frontmatter.slug}`
} else if (parsedFilePath.name !== `index` && !node.frontmatter.permalink) {
slug = `/${slug}/`
slug = `/${slugified}/`
} else if (parsedFilePath.name !== `index`) {
slug = node.frontmatter.permalink
} else {
Expand Down

0 comments on commit 4359af4

Please sign in to comment.