Use dynamic list of categories/tags in sidebar, improve page headers

This commit is contained in:
timvisee 2019-07-01 20:44:24 +02:00
parent 613e17129c
commit cc1b7d22cb
No known key found for this signature in database
GPG Key ID: B8DB720BC383E172
7 changed files with 39 additions and 32 deletions

View File

@ -294,7 +294,7 @@ article > header {
font-family: $font-title;
padding: 0.2em 0.4em;
line-height: 1;
margin: 0.1em;
margin: 0 0.2em 0.2em 0;
}
content .tag {

View File

@ -1,13 +1,15 @@
{% extends "site.html" %}
{% block body %}
<h1>Categories</h1>
<header>
<h1>Categories</h1>
</header>
{% if terms %}
<ul>
{% for term in terms %}
<li>
<a href="{{ term.permalink | safe }}">{{ term.name }}</a>({{ term.pages | length }})
<a href="{{ term.permalink | safe }}">{{ term.name | title }}</a> ({{ term.pages | length }})
</li>
{% endfor %}
</ul>

View File

@ -2,7 +2,9 @@
{% import "post_macros.html" as post_macros %}
{% block body %}
<h1>Category: {{ term.name }}</h1>
<header>
<h1>Category: {{ term.name }}</h1>
</header>
{% for page in term.pages %}
{{ post_macros::page_in_list(page=page) }}

View File

@ -31,7 +31,7 @@
{% if page.summary %}
<div itemprop="summary">
{{ page.summary | safe }}
<nav class="readmore"><a itemprop="url" href="{{ page.permalink | safe }}#continue-reading">Read More&nbsp;&raquo;</a></nav>
<nav class="readmore"><a itemprop="url" href="{{ page.permalink | safe }}#continue-reading">Continue Reading&nbsp;&raquo;</a></nav>
</div>
{% endif %}
</article>

View File

@ -96,38 +96,37 @@
</section>
{% endif %}
<section>
<h1><a href="/categories">Categories</a></h1>
{# Categories #}
{% set categories = get_taxonomy(kind="categories") %}
{% if categories.items | length > 0 %}
<section>
<h1><a href="/categories">Categories</a></h1>
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li>
<a itemprop="url" href="/categories/dev">
<span itemprop="name">Dev</span>
</a>
</li>
<li>
<a itemprop="url" href="#">
<span itemprop="name">Releases</span>
</a>
</li>
{% for catgegory in categories.items %}
<li>
<a itemprop="url" href="{{ catgegory.permalink | safe }}">
<span itemprop="name">{{ catgegory.name | title }}</span>
</a>
</li>
{% endfor %}
</ul>
</nav>
</section>
</section>
{% endif %}
<section>
<h1><a href="/tags">Tags</a></h1>
<div class="tags">
<a href="/tags/test" class="tag">test</a>
<a href="/tags/test" class="tag">test</a>
<a href="/tags/test" class="tag">test</a>
<a href="/tags/test" class="tag">test</a>
<a href="/tags/test" class="tag">test</a>
<a href="/tags/test" class="tag">test</a>
<a href="/tags/test" class="tag">test</a>
</div>
</section>
{# Tags #}
{% set tags = get_taxonomy(kind="tags") %}
{% if tags.items | length > 0 %}
<section>
<h1><a href="/tags">Tags</a></h1>
<div class="tags">
{% for tag in tags.items %}
<a href="{{ tag.permalink | safe }}" class="tag">{{ tag.name }}</a>
{% endfor %}
</div>
</section>
{% endif %}
<p class="muted">
Copyright &copy; {{ config.title }} {{ now() | date(format="%Y") }}

View File

@ -1,7 +1,9 @@
{% extends "site.html" %}
{% block body %}
<h1>Tags</h1>
<header>
<h1>Tags</h1>
</header>
{% if terms %}
<ul>

View File

@ -1,7 +1,9 @@
{% extends "site.html" %}
{% block body %}
<h1>Tag: {{ term.name }}</h1>
<header>
<h1>Tag: {{ term.name }}</h1>
</header>
{% for page in term.pages %}
{{ post_macros::page_in_list(page=page) }}