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

Leading/trailing slash resiliency #22

Open
nixjdm opened this issue Apr 13, 2019 · 3 comments
Open

Leading/trailing slash resiliency #22

nixjdm opened this issue Apr 13, 2019 · 3 comments
Assignees

Comments

@nixjdm
Copy link
Member

nixjdm commented Apr 13, 2019

I noticed this looking at #20 (note @rgommers, @goanpeca ). As of 0.3 this plugin / virtual path resolver is not resilient against different formats of supplying source_path (at least) url fragments in the config file.

In my testing with this site and a simplified config and template fragment of

[feed]
name = blogname
source_path = /blog/
url_path = feed.xml 
{{ '/blog/@atom/feed'|url }}

The jinja only correctly resolved with source_path = /blog. /blog/, blog/, and blog all failed, resulting in a broken rendered template path of blog@atom/feed. This shouldn't be so picky. I'm thinking at least the trailing slash should be optional. There may be a good reason to have to pick the presence of a leading slash though (relative v. absolute).

At the moment I'm not sure where this should to be addressed; here, core, or partially in both.

@goanpeca
Copy link
Member

Hi @nixjdm :-)!

I'm thinking at least the trailing slash should be optional.

I would fix this in core?

And maybe here we could make it just work in case leading is missing?

@rgommers
Copy link

Thanks @nixjdm, that was very helpful. It's indeed pretty fragile. This worked for me:

source_path = /blog
url_path = /blog/feed.xml

and deleting filename. It seems to still generate a feed.xml in addition to blog/feed.xml, but I'll worry about that later - blog/feed.xml works now.

@rgommers
Copy link

Fixing only the trailing slash here makes sense to me.

@goanpeca goanpeca self-assigned this Apr 17, 2019
rgommers added a commit to rgommers/quansight-labs-site that referenced this issue Apr 17, 2019
rgommers added a commit to rgommers/quansight-labs-site that referenced this issue Apr 17, 2019
Note a few workarounds were needed, discussion on
lektor/lektor-atom#22 and issues linked to it.
rgommers added a commit to rgommers/quansight-labs-site that referenced this issue Apr 17, 2019
Note a few workarounds were needed, discussion on
lektor/lektor-atom#22 and issues linked to it.
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

3 participants