From 819fb3814f981047d5f16dc90938d303659ded67 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney <jmg@funkthat.com> Date: Thu, 15 Apr 2021 16:30:54 -0700 Subject: [PATCH] fix up post tags so that they work... --- .gitignore | 3 +++ layout/blog.j2 | 4 +++- layout/tagged_posts.j2 | 28 ++++++++++++++++++++++++++++ site.yaml | 7 +++++-- 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 layout/tagged_posts.j2 diff --git a/.gitignore b/.gitignore index 5724ef1..d3fbcf2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ deploy # virtualenv p + +# automatically generated (not a fan that they're here) +content/search diff --git a/layout/blog.j2 b/layout/blog.j2 index 9dda4cb..4c7cc83 100644 --- a/layout/blog.j2 +++ b/layout/blog.j2 @@ -14,7 +14,7 @@ <ul class="tags clear"> {% for tag in resource.meta.tags %} <li> - <a class="small" href="{{ content_url('blog/tags/'~tag~'.html') }}"> + <a class="small" href="{{ content_url('search/label/'~tag~'.html') }}"> {{ tag }} </a> </li> @@ -22,9 +22,11 @@ </ul> {% endif %} <div class="clear"/> +<section> {% filter markdown|typogrify -%} {% block post -%}{%- endblock %} {%- endfilter %} +</section> </article> {%- endmark %} diff --git a/layout/tagged_posts.j2 b/layout/tagged_posts.j2 new file mode 100644 index 0000000..326b5c2 --- /dev/null +++ b/layout/tagged_posts.j2 @@ -0,0 +1,28 @@ +{% extends "base.j2" %} + +{% block main %} +<section class="archives"> +<h1 class="tag title">{{ tag.name }}</h1> +<ul class="posts clear"> +{% for resource in walker() -%} +<li class="post clear"> + <time datetime="{{ resource.meta.created.strftime('%Y-%m-%d') }}"> + {{ resource.meta.created.strftime('%a, %d %b %Y') }} + </time> + <a href="{{ content_url(resource.url) }}">{{ resource.meta.title }}</a> + {% if resource.meta.tags %} + <ul class="tags"> + {% for tag in resource.meta.tags %} + <li> + <a class="small" href="{{ content_url('search/label/'~tag~'.html') }}"> + {{ tag }} + </a> + </li> + {% endfor %} + </ul> + {% endif %} +</li> +{%- endfor %} +</ul> +</section> +{% endblock %} diff --git a/site.yaml b/site.yaml index 4cdc988..1b51fec 100644 --- a/site.yaml +++ b/site.yaml @@ -38,5 +38,8 @@ tagger: sorter: time archives: blog: - source: blog - target: blog/tags + source: . + target: search/label + template: tagged_posts.j2 + meta: + listable: false