meeb / django-distill

Minimal configuration static site generator for Django
MIT License
441 stars 35 forks source link

Allow to customise output filename of urls with params #66

Closed anentropic closed 1 year ago

anentropic commented 1 year ago

I had urls in my project like:

blog/page/1
blog/page/2

If I don't specify distill_file for the path then distill will output these as above, as files without extensions.

If I do specify distill_file it can only be a static string (e.g. "page.html"), so all the pages will have same filename and overwrite each other.

What is possible currently is if I change my urls to have trailing slash, then distill will treat them as a dir and then I can use distill_file to output with a suffix like blog/page/1/index.html.

But what I really wanted was to output blog/page/1.html.

This PR allows using a format string as the distill_file and then have the url params substituted in when rendering.

anentropic commented 1 year ago

Forgot to say... thanks for this project!

I have been going through all the static site generators for Django and, apart from this minor issue, this is the only one I found that really works for my site without having to start over from scratch.

meeb commented 1 year ago

This looks like a decent addition to me, very happy to have contributions and thanks for the PR. Other than the single comment I've made the rest looks good. This feature needs to be added to the documentation as well but I can do that before the next release.

Glad you find the project useful!

meeb commented 1 year ago

Looks great, thanks for the feature addition!

anentropic commented 1 year ago

You're welcome, thank you!