-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Conversation
Merged this, thanks! These sorts of invariant run-time checks are worth a 1000 Stackoverflow answers :-) Basically any time there's a question on something here or elsewhere that we can add an automated check for we should. I tweaked the messaging a bit and added a link in the message here (eventually we'll have actual doc pages that we can link to) in 2856acc The output now looks like: Invariant Violation:
Paths must be prepended with a forward slash. You set the path to
"hello-world/" in "2015-05-01-hello-world/index.md" but instead it should be "/hello-world/"
See http://bit.ly/1qeNpdy for more. Let me know what you think. |
That looks great. Linking to this PR is a great idea for the time being. |
Hiya @michaeljdeeb! 👋 This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here. Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! 💪💜 |
Some funny things can occur if the path variable is improperly set in the front matter of a page.
This will check that all path strings are prepended with a forward slash.
Some interesting things to note, possibly for documentation or to improve upon the check.
npm test
gatsby build
or the initial launch ofgatsby develop
(not thrown during hot reloading)/pages/2015-05-01-hello-world/salty_egg.jpg
would become/hello-worldsalty_egg.jpg
if path were set to/hello-world
404.md
to have the path/404.html
for GitHub Pages.