Skip to content

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

@sethm

Description

@sethm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions