acrylamid icon indicating copy to clipboard operation
acrylamid copied to clipboard

URLs with .html extension

Open hooli opened this issue 11 years ago • 1 comments

Hi,

I setup up some rules to generate URLs to .html files rather than plain directory URLs. The rules just leaving off the trailing "/", as mentioned in the docs: '/blog/': {'filters': 'summarize', 'view': 'index', 'pagination': '/blog/index-:num.html'} '/blog/tag/:name.html': {'filters': 'summarize', 'view':'tag', 'pagination': '/blog/tag/:name-:num.html'}

Unfortunately, there are a couple of links that still generate trailing "/"

  1. Next / Previous These links had a trailing "/", eg /blog/index-2.html/
    This is an easy fix in the main.html template, by removing the ~ '/' {% if env.prev is not none %}

  2. tags and categories These also have trailing "/", but it is added in the code, eg in view/tag.py def init(self, title, href): self.title = title self.href = href if href.endswith('/') else href + '/'

Is it OK to remove the appended "/" check? It seems to work fine without it. If it is needed, should it check the path for a trailing "/", or if the href has an extension instead?

Cheers.

hooli avatar May 24 '13 13:05 hooli

Hi Hooli,

the href.endswith('/') thing can be safely removed, it is no longer needed since Acrylamid supports non-index URLs. I've pushed your changes to PyPi as version 0.7.4.

I did not fix the templates yet, I'll leave this issue open as a reminder.

posativ avatar May 26 '13 12:05 posativ