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

Missing leading slash: no error, but wrong filename #1015

Closed
ddfreyne opened this Issue Dec 17, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@ddfreyne
Copy link
Member

commented Dec 17, 2016

A routing rule that returns a path that does not start with a slash will cause the filename to be stupidly concatenated to the output dir name.

See this blog post:

One major gotcha is that the beginning slash is necessary for globs and paths. If you don’t include a beginning slash for globs and paths, Nanoc will end up concatenating the name of the default base directory it’s meant to use (like content or output) with the glob or path (yeah, I find this dumb – just remember the beginning slash).

For example, the following:

compile '/foo.*' do
  filter :erb, stuff: self
  write 'foo.html'
end

… writes outputfoo.html.

@ddfreyne ddfreyne changed the title Missing lading slash Missing leading slash: no error, but wrong filename Dec 17, 2016

@ddfreyne

This comment has been minimized.

Copy link
Member Author

commented Dec 17, 2016

CC @caseywilliams — I found this bug on your “Using Nanoc 4” article.

@ddfreyne ddfreyne added this to the 4.4.3 milestone Dec 17, 2016

ddfreyne added a commit that referenced this issue Dec 17, 2016

Merge pull request #1016 from nanoc/gh-1015-route-without-leading-slash
Raise error if item rep path does not start with slash
@ddfreyne

This comment has been minimized.

Copy link
Member Author

commented Dec 17, 2016

Fixed in #1016.

@ddfreyne ddfreyne closed this Dec 17, 2016

@caseywilliams

This comment has been minimized.

Copy link

commented Dec 17, 2016

@ddfreyne, wow, you're amazing! Thank you for this and all of your excellent work on Nanoc! I've updated my article, too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.