Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verifying that path strings are prepended a forward slash #223

Merged
merged 2 commits into from
Apr 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ All templates, css, and content are *hot reloadable*.
* [nordnet.se/brand](https://www.nordnet.se/brand/)
* [likescoffee.com](http://likescoffee.com/) ([source](https://github.com/pamo/pamo.github.io/tree/development))
* [vii.campjs.com](http://vii.campjs.com/) ([source](https://github.com/campjs/campjs-vii))
* [michaeljdeeb.com](http://michaeljdeeb.com) ([source](https://github.com/michaeljdeeb/michaeljdeeb-gatsby-blog))
* [Edit this file to add yours!](https://github.com/gatsbyjs/gatsby/blob/master/README.md)

### Why use Gatsby instead of other Static Site Generators
Expand Down
6 changes: 6 additions & 0 deletions lib/utils/glob-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import fs from 'fs'
import frontMatter from 'front-matter'
import htmlFrontMatter from 'html-frontmatter'
import objectAssign from 'object-assign'
import invariant from 'invariant'
const debug = require('debug')('gatsby:glob')
let rewritePath
try {
Expand Down Expand Up @@ -76,6 +77,11 @@ module.exports = (directory, callback) => {
if (!(parsed.name.slice(0, 1) === '_')) {
if (data.path) {
// Path was hardcoded.
const pathInvariantMessage = `
You're setting path to ${data.path} for ${parsed.dirname},
but it should be /${data.path}
`
invariant((data.path.charAt(0) === '/'), pathInvariantMessage)
pageData.path = data.path
} else if (rewritePath) {
pageData.path = rewritePath(parsed, pageData)
Expand Down