Split uri into url and destination, remove trailing slashes from links
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
{% extends "base.html" %}
|
||||
{% set prefix = (label + "/") if kind == "section" else (("tags/" + label + "/") if kind == "tag" else "") %}
|
||||
{% set base_path = ("/" + label) if kind == "section" else (("/tags/" + label) if kind == "tag" else "") %}
|
||||
{% set heading = label or "" %}
|
||||
|
||||
{% block title %}{% if heading %}{{ heading }} — {% endif %}{{ site.name }}{% if page_num > 1 %} — Page {{ page_num }}{% endif %}{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
<link rel="canonical" href="{{ site.origin }}{{ site.base_dir }}{{ prefix }}{% if page_num > 1 %}page-{{ page_num }}.html{% endif %}">
|
||||
<link rel="canonical" href="{{ site.origin }}{{ site.base_dir }}{% if page_num == 1 %}{{ base_path or "/" }}{% else %}{{ base_path }}/page-{{ page_num }}.html{% endif %}">
|
||||
{% if page_num > 1 %}<meta name="robots" content="noindex, follow">{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block breadcrumb %}
|
||||
{% if kind == "section" %}
|
||||
<nav aria-label="breadcrumb">
|
||||
<a href="{{ site.base_dir }}">{{ site.name }}</a> ›
|
||||
<a href="{{ site.base_dir or "/" }}">{{ site.name }}</a> ›
|
||||
{{ label }}
|
||||
</nav>
|
||||
{% elif kind == "tag" %}
|
||||
<nav aria-label="breadcrumb">
|
||||
<a href="{{ site.base_dir }}">{{ site.name }}</a> ›
|
||||
<a href="{{ site.base_dir }}tags/">Tags</a> ›
|
||||
<a href="{{ site.base_dir or "/" }}">{{ site.name }}</a> ›
|
||||
<a href="{{ site.base_dir }}/tags">Tags</a> ›
|
||||
{{ label }}
|
||||
</nav>
|
||||
{% else %}
|
||||
@@ -31,7 +31,7 @@
|
||||
{% for item in items %}
|
||||
<article>
|
||||
<header>
|
||||
<h2><a href="{{ site.base_dir }}{{ item.uri }}">{{ item.title }}</a></h2>
|
||||
<h2><a href="{{ site.base_dir }}{{ item.url }}">{{ item.title }}</a></h2>
|
||||
<time datetime="{{ item.created }}">{{ item.created }}</time>
|
||||
</header>
|
||||
{% if item.summary %}<p>{{ item.summary }}</p>{% endif %}
|
||||
@@ -40,15 +40,15 @@
|
||||
{% if total_pages > 1 %}
|
||||
<nav>
|
||||
{% if page_num > 1 %}
|
||||
<a href="{{ site.base_dir }}{{ prefix }}{{ "" if page_num - 1 == 1 else "page-" ~ (page_num - 1) ~ ".html" }}">← Newer</a>
|
||||
<a href="{{ site.base_dir }}{% if page_num - 1 == 1 %}{{ base_path or "/" }}{% else %}{{ base_path }}/page-{{ page_num - 1 }}.html{% endif %}">← Newer</a>
|
||||
{% endif %}
|
||||
{% for p in range(1, total_pages + 1) %}
|
||||
{% if p == page_num %}<strong>{{ p }}</strong>
|
||||
{% else %}<a href="{{ site.base_dir }}{{ prefix }}{{ "" if p == 1 else "page-" ~ p ~ ".html" }}">{{ p }}</a>
|
||||
{% else %}<a href="{{ site.base_dir }}{% if p == 1 %}{{ base_path or "/" }}{% else %}{{ base_path }}/page-{{ p }}.html{% endif %}">{{ p }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if page_num < total_pages %}
|
||||
<a href="{{ site.base_dir }}{{ prefix }}page-{{ page_num + 1 }}.html">Older →</a>
|
||||
<a href="{{ site.base_dir }}{{ base_path }}/page-{{ page_num + 1 }}.html">Older →</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user