PlaidWeb / Publ

Flexible publishing system for the web
http://publ.beesbuzz.biz/
MIT License
40 stars 4 forks source link

Better normalization of template-based category links #533

Closed fluffy-critter closed 1 year ago

fluffy-critter commented 1 year ago

Expected Behavior

The template global shouldn't have a value if it isn't being overridden in the current view.

Current Behavior

template always provides the canonical template name even if it isn't being overridden; for example on the path /foo/blog/, template will have a value of index, so view.link(template=template) ends up pointing to /foo/blog/index, which is not desirable.

Possible Solution

path 1

rendering.render_category_path can set a flag based on whether the template was overridden, and use that as a parameter to template.map_template which could set an appropriate attribute on the resulting object.

There will also have to be some way of getting the actual template name vs. the path suffix, so that things where the template name is needed will still function correctly.

path 2

view.link and category.link could check to see if the category's category-template matches the given parameter, and if so, elides the given parameter.

Path 2 would probably be better overall.

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Context