diff options
Diffstat (limited to '')
-rw-r--r-- | templates/atom.xml | 33 | ||||
-rw-r--r-- | templates/base.html | 27 | ||||
-rw-r--r-- | templates/index.html | 8 | ||||
-rw-r--r-- | templates/macros.html | 43 | ||||
-rw-r--r-- | templates/page.html | 27 | ||||
-rw-r--r-- | templates/shortcodes/img.html | 9 | ||||
-rw-r--r-- | templates/shortcodes/ref.html | 1 | ||||
-rw-r--r-- | templates/tags/list.html | 19 | ||||
-rw-r--r-- | templates/tags/single.html | 20 |
9 files changed, 187 insertions, 0 deletions
diff --git a/templates/atom.xml b/templates/atom.xml new file mode 100644 index 0000000..ab0012c --- /dev/null +++ b/templates/atom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}"> + <title>{{ config.title }} + {%- if term %} - {{ term.name }} + {%- elif section.title %} - {{ section.title }} + {%- endif -%} + </title> + {%- if config.description %} + <subtitle>{{ config.description }}</subtitle> + {%- endif %} + <link href="{{ feed_url | safe }}" rel="self" type="application/atom+xml"/> + <link href=" + {%- if section -%} + {{ section.permalink | escape_xml | safe }} + {%- else -%} + {{ config.base_url | escape_xml | safe }} + {%- endif -%} + "/> + <generator uri="https://www.getzola.org/">Zola</generator> + <updated>{{ last_updated | date(format="%+") }}</updated> + <id>{{ feed_url | safe }}</id> + {%- for page in pages %} + <entry xml:lang="{{ page.lang }}"> + <author><name>{{ config.extra.author }}</name></author> + <title>{{ page.title | default(value="Post № " ~ page.slug)}}</title> + <published>{{ page.date | date(format="%+") }}</published> + <updated>{{ page.updated | default(value=page.date) | date(format="%+") }}</updated> + <link href="{{ page.permalink | safe }}" type="text/html"/> + <id>{{ page.permalink | safe }}</id> + <content type="html">{{ page.content }}</content> + </entry> + {%- endfor %} +</feed> diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..edce080 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,27 @@ +{% import "macros.html" as macros -%} +<!DOCTYPE html> +<html lang="en"> + <head> + <title>{{ config.title ~ " · " }}{% block title %}{{ config.description }}{% endblock %}</title> + <link rel="stylesheet" href="/style.css"/> + <link rel="icon" href="/icon.svg"/> + <link rel="alternate" type="application/atom+xml" title="zunzuncito" href="/atom.xml" /> + {%- block additional_feeds %}{% endblock %} + <meta charset="utf-8"/> + <meta name="viewport" content="width=device-width, initial-scale=1"/> + </head> + <body> + <main> + <header> + <h1><a href="/">{{ config.title }}</a></h1> + <div class="banner smaller"> + {{ config.description }} · + {%- block description %} + <a href="/atom.xml">feed</a> · <a href="/tags">tags</a> + {%- endblock %} + </div> + </header> + {%- block content %}{% endblock -%} + </main> + </body> +</html> diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..87220f7 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} + +{%- block content %} +{%- for post in paginator.pages %} + {{ macros::render_post(post=post) }} +{%- endfor -%} +{{ macros::render_pagination(paginator=paginator) }} +{%- endblock content %} diff --git a/templates/macros.html b/templates/macros.html new file mode 100644 index 0000000..9f0f792 --- /dev/null +++ b/templates/macros.html @@ -0,0 +1,43 @@ +{% macro render_post(post, mention=false, in_feed=true) -%} +{% if mention -%} +<article class="mention"> +{% else -%} +<article> +{% endif -%} + <header> + <img class="avatar" alt="{{ config.extra.author }}" src="{{ config.extra.avatar }}" /> + <div class="banner smaller"> + <span class="info"> + <a class="bold-hover" title="permalink to this post" href="{{ post.permalink }}">{% if mention %}№ {{ post.slug }} {% else %}§{% endif %}</a> + <time class="mute" datetime="{{ post.date }}" title="{{ post.date }}">{{ post.date | date(format="%F %R") }}</time> + {%- if post.draft %}<span class="warning">DRAFT</span>{% endif %} + </span> + {%- if "tags" in post.taxonomies %} + <nav class="tags"> + <ul class="inline">{{ self::render_tags(tags=post.taxonomies.tags) }}</ul> + </nav> + {%- endif %} + </div> + </header> + <section class="post">{{ post.content | safe }}</section> +</article> +{% endmacro render_post -%} + +{%- macro render_pagination(paginator) %} +{%- if paginator.number_pagers > 1 %} +<nav class="pagination"> + {%- if paginator.previous %} + <a class="newer" href="{{ paginator.previous }}">‹ newer</a> + {%- endif %} + {%- if paginator.next %} + <a class="older" href="{{ paginator.next }}">older ›</a> + {%- endif %} +</nav> +{%- endif %} +{%- endmacro render_pagination -%} + +{%- macro render_tags(tags) %} +{%- for tag in tags %} + <li><a class="tag" href="{{ get_taxonomy_url(kind="tags", name=tag) }}">{{ tag }}</a></li> +{%- endfor %} +{%- endmacro render_tags %} diff --git a/templates/page.html b/templates/page.html new file mode 100644 index 0000000..8703c7c --- /dev/null +++ b/templates/page.html @@ -0,0 +1,27 @@ +{% extends "base.html" -%} + +{%- block title -%} +{%- if page.title -%} +{{ page.title }} +{%- else -%} +post № {{ page.slug }} +{%- endif -%} +{%- endblock title -%} + +{%- block description %} +post № {{ page.slug }} +{%- if page.title -%} +· <em>{{ page.title }}</em> +{%- endif -%} +{%- endblock description %} + +{%- block content %} +{{ macros::render_post(post=page, in_feed=false) }} +{%- if "mentions" in page.extra and page.extra.mentions | length > 0 -%} +<h2 class="mentions">Mentioned posts</h2> +{%- for ref in page.extra.mentions %} +{%- set page = get_page(path=ref ~ "/index.md") -%} +{{ macros::render_post(post=page, mention=true) }} +{%- endfor %} +{%- endif %} +{%- endblock content %} diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html new file mode 100644 index 0000000..13d38d6 --- /dev/null +++ b/templates/shortcodes/img.html @@ -0,0 +1,9 @@ +{% set url = page.path ~ path | trim_start_matches(pat="/") -%} +<figure> + <a href="/{{ url }}"> + <img src="{{ resize_image(path=url, width=500, op="fit_width") }}" alt="{{ alt }}" /> + </a> + {% if caption -%} + <figcaption class="smaller">{{ caption }}</figcaption> + {% endif -%} +</figure> diff --git a/templates/shortcodes/ref.html b/templates/shortcodes/ref.html new file mode 100644 index 0000000..6708552 --- /dev/null +++ b/templates/shortcodes/ref.html @@ -0,0 +1 @@ +<a href="/{{ id }}">{{ text | default(value="№ " ~ id) }}</a> diff --git a/templates/tags/list.html b/templates/tags/list.html new file mode 100644 index 0000000..0cab254 --- /dev/null +++ b/templates/tags/list.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} + +{%- block title -%} +all tags +{%- endblock title -%} + +{%- block description %} +all tags +{%- endblock description %} + +{% block content %} +<nav class="tags"> + <ul class="inline"> + {%- for term in terms %} + <li><a class="tag bigger" href="{{ get_taxonomy_url(kind="tags", name=term.name) }}">{{ term.name }}<sup>{{ term.pages | length }}</sup></a></li> + {%- endfor %} + </ul> +</nav> +{% endblock content %} diff --git a/templates/tags/single.html b/templates/tags/single.html new file mode 100644 index 0000000..2238061 --- /dev/null +++ b/templates/tags/single.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} + +{%- block additional_feeds %} +<link rel="alternate" type="application/atom+xml" title="zunzuncito - #{{ term.name }}" href="atom.xml" /> +{%- endblock %} + +{%- block title -%} +posts tagged with #{{ term.name }} +{%- endblock title -%} + +{%- block description %} +posts tagged with #{{ term.name }} · <a href="atom.xml">feed</a> +{%- endblock description %} + +{%- block content %} +{%- for post in paginator.pages %} + {{ macros::render_post(post=post) }} +{%- endfor %} +{{ macros::render_pagination(paginator=paginator) }} +{%- endblock content %} |