Add taxonomies
This commit is contained in:
parent
b83019b913
commit
d92e1fb705
7 changed files with 114 additions and 27 deletions
19
templates/categories.html
Normal file
19
templates/categories.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{% extends "index.html" %}
|
||||
|
||||
{% block content %}
|
||||
{% block header %}
|
||||
{{ super() }}
|
||||
{% endblock header %}
|
||||
|
||||
<h1>Categories</h1>
|
||||
|
||||
{% if categories %}
|
||||
<ul>
|
||||
{% for category in categories %}
|
||||
<li>
|
||||
<a href="{{ category.permalink }}">{{ category.name }}</a>({{ category.pages | length }})
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
14
templates/category.html
Normal file
14
templates/category.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
{% extends "index.html" %}
|
||||
{% import "post_macros.html" as post_macros %}
|
||||
|
||||
{% block content %}
|
||||
{% block header %}
|
||||
{{ super() }}
|
||||
{% endblock header %}
|
||||
|
||||
<h1>{{ category.name }}</h1>
|
||||
|
||||
{% for page in category.pages %}
|
||||
{{ post_macros::page_in_list(page=page) }}
|
||||
{% endfor %}
|
||||
{% endblock content %}
|
|
@ -25,19 +25,21 @@
|
|||
|
||||
<body class="hack dark main container">
|
||||
{% block content %}
|
||||
{% if config.extra.after_dark_menu %}
|
||||
<header>
|
||||
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
|
||||
{% for item in config.extra.after_dark_menu %}
|
||||
<a itemprop="url"
|
||||
class="{% if item.url | replace(from="$BASE_URL", to=config.base_url) == current_url %}active{% endif %}"
|
||||
href="{{ item.url | replace(from="$BASE_URL", to=config.base_url) }}">
|
||||
<span itemprop="name">{{ item.name }}
|
||||
</span></a>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
</header>
|
||||
{% endif %}
|
||||
{% block header %}
|
||||
{% if config.extra.after_dark_menu %}
|
||||
<header>
|
||||
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
|
||||
{% for item in config.extra.after_dark_menu %}
|
||||
<a itemprop="url"
|
||||
class="{% if item.url | replace(from="$BASE_URL", to=config.base_url) == current_url %}active{% endif %}"
|
||||
href="{{ item.url | replace(from="$BASE_URL", to=config.base_url) }}">
|
||||
<span itemprop="name">{{ item.name }}
|
||||
</span></a>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
</header>
|
||||
{% endif %}
|
||||
{% endblock header %}
|
||||
|
||||
<main>
|
||||
{% if config.extra.after_dark_title %}
|
||||
|
@ -46,20 +48,7 @@
|
|||
</header>
|
||||
{% endif %}
|
||||
{% for page in paginator.pages %}
|
||||
<article itemscope itemtype="http://schema.org/CreativeWork">
|
||||
<header>
|
||||
<h2 itemprop="name">
|
||||
<a href="{{ page.permalink }}">{{ page.title }}</a>
|
||||
</h2>
|
||||
<span class="muted">{{ post_macros::meta(page=page) }}</span>
|
||||
</header>
|
||||
{% if page.summary %}
|
||||
<div itemprop="summary">
|
||||
{{ page.summary | safe }}
|
||||
<nav class="readmore"><a itemprop="url" href="{{ page.permalink }}">Read More »</a></nav>
|
||||
</div>
|
||||
{% endif %}
|
||||
</article>
|
||||
{{ post_macros::page_in_list(page=page) }}
|
||||
{% endfor %}
|
||||
|
||||
<nav>
|
||||
|
|
|
@ -19,6 +19,24 @@
|
|||
{% if config.extra.author %}
|
||||
Published by {{ config.extra.author }}
|
||||
{% endif %}
|
||||
{% if page.category %}
|
||||
in <a href="{{ get_taxonomy_url(kind="category", name=page.category) }}">{{ page.category }}</a>
|
||||
{% endif %}
|
||||
{% if page.tags %}
|
||||
and tagged
|
||||
{% for tag in page.tags %}
|
||||
<a href="{{ get_taxonomy_url(kind="tag", name=tag) }}">{{ tag }}</a>
|
||||
{% if page.tags | length > 1 %}
|
||||
{% if loop.index != page.tags | length %}
|
||||
{% if loop.index == page.tags | length - 1 %}
|
||||
and
|
||||
{% else %}
|
||||
,
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</p>
|
||||
</footer>
|
||||
{% endblock page_footer %}
|
||||
|
|
|
@ -14,3 +14,20 @@
|
|||
|
||||
Published: {{ page.date | date(format="%F") }}
|
||||
{% endmacro meta %}
|
||||
|
||||
{% macro page_in_list(page) %}
|
||||
<article itemscope itemtype="http://schema.org/CreativeWork">
|
||||
<header>
|
||||
<h2 itemprop="name">
|
||||
<a href="{{ page.permalink }}">{{ page.title }}</a>
|
||||
</h2>
|
||||
<span class="muted">{{ self::meta(page=page) }}</span>
|
||||
</header>
|
||||
{% if page.summary %}
|
||||
<div itemprop="summary">
|
||||
{{ page.summary | safe }}
|
||||
<nav class="readmore"><a itemprop="url" href="{{ page.permalink }}">Read More »</a></nav>
|
||||
</div>
|
||||
{% endif %}
|
||||
</article>
|
||||
{% endmacro page_in_list %}
|
||||
|
|
13
templates/tag.html
Normal file
13
templates/tag.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{% extends "index.html" %}
|
||||
|
||||
{% block content %}
|
||||
{% block header %}
|
||||
{{ super() }}
|
||||
{% endblock header %}
|
||||
|
||||
<h1>{{ tag.name }}</h1>
|
||||
|
||||
{% for page in tag.pages %}
|
||||
{{ post_macros::page_in_list(page=page) }}
|
||||
{% endfor %}
|
||||
{% endblock content %}
|
17
templates/tags.html
Normal file
17
templates/tags.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
{% extends "index.html" %}
|
||||
|
||||
{% block content %}
|
||||
{% block header %}
|
||||
{{ super() }}
|
||||
{% endblock header %}
|
||||
|
||||
<h1>Tags</h1>
|
||||
|
||||
{% if tags %}
|
||||
<ul>
|
||||
{% for tag in tags %}
|
||||
<li><a href="{{ tag.permalink }}">{{ tag.name }}</a> ({{ tag.pages | length }})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
Loading…
Reference in a new issue