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
Urls starting with / handled as absolute urls from the root #62
Conversation
Welcome! Congrats on your first pull request to Jekyll Relative Links. If you haven't already, please be sure to check out the contributing guidelines. |
Also found an old issue, #47 |
relative_path.sub!(%r!\A/!, "") | ||
absolute_path = File.expand_path(relative_path, url_base) | ||
base = is_absolute ? "" : url_base | ||
absolute_path = File.expand_path(relative_path, base) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to put this in path_from_root
rather than passing it around?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @krichardsson!
Congrats on getting your first pull request to Jekyll Relative Links merged! Without amazing humans like you submitting pull requests, we couldn’t run this project. You rock! 🎉 |
This pull requests makes absolute urls behave the same way as on github. A url that starts with a / should be interpreted as an absolute url, starting from the root.
Example:
if we have the file foo/bar.md, containing the link
[my absolute link](/foo/bar.md)
, the generated html should point to /foo/bar/View rendered spec/fixtures/site/page.md
View rendered spec/fixtures/site/subdir/page.md