Browse Source

Add taxonomies

master
Vincent Prouillet 7 years ago
parent
commit
d92e1fb705
  1. 19
      templates/categories.html
  2. 14
      templates/category.html
  3. 43
      templates/index.html
  4. 18
      templates/page.html
  5. 17
      templates/post_macros.html
  6. 13
      templates/tag.html
  7. 17
      templates/tags.html

19
templates/categories.html

@ -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

@ -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 %}

43
templates/index.html

@ -25,19 +25,21 @@
<body class="hack dark main container"> <body class="hack dark main container">
{% block content %} {% block content %}
{% if config.extra.after_dark_menu %} {% block header %}
<header> {% if config.extra.after_dark_menu %}
<nav itemscope itemtype="http://schema.org/SiteNavigationElement"> <header>
{% for item in config.extra.after_dark_menu %} <nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<a itemprop="url" {% for item in config.extra.after_dark_menu %}
class="{% if item.url | replace(from="$BASE_URL", to=config.base_url) == current_url %}active{% endif %}" <a itemprop="url"
href="{{ item.url | replace(from="$BASE_URL", to=config.base_url) }}"> class="{% if item.url | replace(from="$BASE_URL", to=config.base_url) == current_url %}active{% endif %}"
<span itemprop="name">{{ item.name }} href="{{ item.url | replace(from="$BASE_URL", to=config.base_url) }}">
</span></a> <span itemprop="name">{{ item.name }}
{% endfor %} </span></a>
</nav> {% endfor %}
</header> </nav>
{% endif %} </header>
{% endif %}
{% endblock header %}
<main> <main>
{% if config.extra.after_dark_title %} {% if config.extra.after_dark_title %}
@ -46,20 +48,7 @@
</header> </header>
{% endif %} {% endif %}
{% for page in paginator.pages %} {% for page in paginator.pages %}
<article itemscope itemtype="http://schema.org/CreativeWork"> {{ post_macros::page_in_list(page=page) }}
<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&nbsp;&raquo;</a></nav>
</div>
{% endif %}
</article>
{% endfor %} {% endfor %}
<nav> <nav>

18
templates/page.html

@ -19,6 +19,24 @@
{% if config.extra.author %} {% if config.extra.author %}
Published by {{ config.extra.author }} Published by {{ config.extra.author }}
{% endif %} {% 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> </p>
</footer> </footer>
{% endblock page_footer %} {% endblock page_footer %}

17
templates/post_macros.html

@ -14,3 +14,20 @@
Published: {{ page.date | date(format="%F") }} Published: {{ page.date | date(format="%F") }}
{% endmacro meta %} {% 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&nbsp;&raquo;</a></nav>
</div>
{% endif %}
</article>
{% endmacro page_in_list %}

13
templates/tag.html

@ -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

@ -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…
Cancel
Save