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

Route names that include a hyphen cause url_for link exports to fail #22

Closed
sethm opened this issue Feb 5, 2021 · 2 comments
Closed

Comments

@sethm
Copy link

sethm commented Feb 5, 2021

I set up a very simple new site to play with with the following structure:

.
├── blog
│   ├── first_post.org
│   └── second_post.org
├── pages
│   └── index.org
├── publish.el
└── templates
    ├── blog.html
    ├── layout.html
    ├── page.html
    └── post.html

My publish.el contains the following routes:

(weblorg-route
 :name "pages"
 :input-pattern "pages/*.org"
 :template "page.html"
 :output "output/{{ slug }}.html"
 :url "/{{ slug }}.html")

(weblorg-route
 :name "blog"
 :input-pattern "blog/*.org"
 :template "post.html"
 :output "output/blog/{{ slug }}.html"
 :url "/blog/{{ slug }}.html")

(weblorg-route
 :name "blog-index"
 :input-pattern "blog/*.org"
 :input-aggregate #'weblorg-input-aggregate-all-desc
 :template "blog.html"
 :output "output/blog/index.html"
 :url "/blog/")

In my main index.org, I have the following link:

[[url_for:blog-index,slug=index][Check out my blog]]

Publishing fails with the error:

Template Error: Variable `slug' not declared

Doing a little digging around, it looks like the problem is actually the hyphen in the name of the route blog-index! If, instead of blog-index, I rename the route to blog_index, and change the link to [[url_for:blog_index,slug=index]], publishing works perfectly.

@sethm sethm changed the title Routes names that include a hyphen cause url_for link exports to fail Route names that include a hyphen cause url_for link exports to fail Feb 5, 2021
@clarete
Copy link
Collaborator

clarete commented Feb 5, 2021

Hi @sethm, thank you for taking the time to write such a thorough bug report. I found the culprit of the issue and fixed it here: 55590fe. I'm going to close the ticket but it might take a tiny bit for melpa to re-build the package (in case that's the source you use).

Please reopen this ticket or file a new one if that doesn't work for you! :D

@clarete clarete closed this as completed Feb 5, 2021
@sethm
Copy link
Author

sethm commented Feb 5, 2021

Works perfectly, thank you!

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

No branches or pull requests

2 participants