Support all edge cases for direct template links

Non-hardcoded paths are not that simple.

Direct templates do not always have meaningful *_URL or even *_SAVE_AS
values. More than that, those variables are not even defined by default.
Therefore we need to replicate the logic used by Pelican itself when
calculating the path to direct template output.

Related:

- DIRECT_TEMPLATES handling by Pelican:
  01eb08c42b/pelican/generators.py (L537-L550)
- Pelican issue for "Why are CATEGORIES_URL and TAGS_URL gone?"
  https://github.com/getpelican/pelican/issues/1225

Merges #75
main
Vitaly Potyarkin 2019-10-22 11:47:27 +03:00
parent ffcbf4168e
commit a392498f69
1 changed files with 4 additions and 4 deletions

View File

@ -1,12 +1,12 @@
<div class="row">
<ul class="col-sm-6 list-inline">
{% if not HIDE_AUTHORS %}
<li class="list-inline-item"><a href="{{ SITEURL }}/{{ AUTHORS_URL }}">Authors</a></li>
<li class="list-inline-item"><a href="{{ SITEURL }}/{{ AUTHORS_URL or AUTHORS_SAVE_AS or 'authors.html' }}">Authors</a></li>
{% endif %}
<li class="list-inline-item"><a href="{{ SITEURL }}/{{ ARCHIVES_URL }}">Archives</a></li>
<li class="list-inline-item"><a href="{{ SITEURL }}/{{ CATEGORIES_URL }}">Categories</a></li>
<li class="list-inline-item"><a href="{{ SITEURL }}/{{ ARCHIVES_URL or ARCHIVES_SAVE_AS or 'archives.html' }}">Archives</a></li>
<li class="list-inline-item"><a href="{{ SITEURL }}/{{ CATEGORIES_URL or CATEGORIES_SAVE_AS or 'categories.html' }}">Categories</a></li>
{% if tags|length %}
<li class="list-inline-item"><a href="{{ SITEURL }}/{{ TAGS_URL }}">Tags</a></li>
<li class="list-inline-item"><a href="{{ SITEURL }}/{{ TAGS_URL or TAGS_SAVE_AS or 'tags.html' }}">Tags</a></li>
{% endif %}
</ul>
<p class="col-sm-6 text-sm-right text-muted">