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

Fix path rewrite for pages with paths not ending with '/' #259

Merged
merged 1 commit into from
Apr 27, 2016

Conversation

jakubrohleder
Copy link
Contributor

@jakubrohleder jakubrohleder commented Apr 26, 2016

Today I started playing with this library a little and noticed, that for pages with paths, that does not end with '/' the static files paths are rewritten in the wrong way.

E.g. for page :


---
title: Hello World
date: "2015-05-01T22:12:03.284Z"
layout: post
path: "/hello-world"

---

![Chinese Salty Egg](./salty_egg.jpg)

Path of salty_egg.jpg will be rewritten into public/hello-worldsalty_egg.jpg instead of public/hello-world/salty_egg.jpg.

This simple patch fixes that issue.

@michaeljdeeb
Copy link
Contributor

This seems to solve the problem and take care of the cases I was worried about in #223. Awesome!

@KyleAMathews
Copy link
Contributor

So this seems great. I assume you've setup your server so it'll serve urls lacking trailing slashes correctly?

@KyleAMathews KyleAMathews merged commit 2401473 into gatsbyjs:master Apr 27, 2016
@jakubrohleder
Copy link
Contributor Author

@KyleAMathews To be true I haven't done much. Just created extra directory /blog, copied index.html and post's directories there. Then I removed trailing slashes from post's front matter.

The only thing that was not working were images. With this PR everything seems to work fine with gatsby develop as well as on gh-pages.

@jakubrohleder jakubrohleder deleted the fix/file-path-rewrite branch April 27, 2016 09:35
benstepp added a commit to benstepp/gatsby that referenced this pull request Apr 27, 2016
This currently fails. The change in gatsbyjs#259 will make it pass. Currently
the image comes out at the wrong path (/hello-worldimage.jpg)

ava doesnt have test.failing() yet, and our eslint config prevents the
usage of test.todo() so this will most defininitely blow up travis.
KyleAMathews pushed a commit that referenced this pull request Apr 27, 2016
This currently fails. The change in #259 will make it pass. Currently
the image comes out at the wrong path (/hello-worldimage.jpg)

ava doesnt have test.failing() yet, and our eslint config prevents the
usage of test.todo() so this will most defininitely blow up travis.
@jlengstorf
Copy link
Contributor

Hiya @jakubrohleder! 👋

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:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (We’ve got t-shirts and hats, plus some socks that are really razzing our berries right now.)
  2. If you’re not already part of it, we just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. You’ll receive an email shortly asking you to confirm. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again! 💪💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants