Skip to content

Commit

Permalink
Tags!
Browse files Browse the repository at this point in the history
  • Loading branch information
metaterminal committed Sep 3, 2024
1 parent 194348e commit 24f4c3f
Show file tree
Hide file tree
Showing 13 changed files with 130 additions and 3 deletions.
6 changes: 5 additions & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ compile_sass = true
# Whether to build a search index to be used later on by a JavaScript library
build_search_index = true

taxonomies = [
{ name = "tags", feed = true, paginate_by = 10 },
]

[markdown]
# Whether to do syntax highlighting
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
Expand All @@ -16,4 +20,4 @@ smart_punctuation = true
[extra]
# Put all your custom variables here

generate_feed = true
generate_feed = true
3 changes: 3 additions & 0 deletions content/blog/bph-1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
+++
title = "Single points of failure"
date = 2023-05-25

[taxonomies]
tags = ["puzzles","recap","bph"]
+++

> *This the first of an expected three posts about Brown Puzzlehunt.*
Expand Down
3 changes: 3 additions & 0 deletions content/blog/bph-2.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
+++
title = "Accessibility, Americanisms, and the location-attendance question"
date = 2023-06-12

[taxonomies]
tags = ["puzzles","recap","bph"]
+++

> *This the second of an expected three posts about Brown Puzzlehunt.*
Expand Down
3 changes: 3 additions & 0 deletions content/blog/favourite-words.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
+++
title = "An incomplete list of people's favourite words"
date = 2023-09-03

[taxonomies]
tags = ["mischief"]
+++

On a date that my notes helpfully notate as "38 wks ago", a friend and I decided to document some words that people liked.
Expand Down
3 changes: 3 additions & 0 deletions content/blog/inscryption.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
+++
title = "Inscryption, or what could have been"
date = 2023-08-25

[taxonomies]
tags = ["analysis"]
+++

> *This essay contains spoilers for the 2020 video game* Inscryption.
Expand Down
3 changes: 3 additions & 0 deletions content/blog/words-on-the-street.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
+++
title = "There's word on the street"
date = 2023-05-24

[taxonomies]
tags = ["puzzles","analysis"]
+++

I've recently been playing... <!-- more --> (well, I was, before health things and international travel and exams got in the way)...
Expand Down
6 changes: 5 additions & 1 deletion sass/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,8 @@ body > footer {
height: 4px;
background: var(--rich-highlight);
z-index: 10000;
}
}

.subtitle, .tags {
margin-left: 0.5em;
}
2 changes: 2 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% import 'macros.html' as macros %}

<!DOCTYPE html>
<html lang="en">
<head>
Expand Down
6 changes: 5 additions & 1 deletion templates/blog-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
<main>
<article>
<h1 class="title">{% if page.extra.display_title %}{{ page.extra.display_title | markdown(inline=true) | safe }}{% else %}{{ page.title }}{% endif %}</h1>
<p class="subtitle"><strong>{{ page.date | date(format="%B %d, %Y") }}</strong></p>
<div class="subtitle"><span><strong>{{ page.date | date(format="%B %d, %Y") }}</strong></span>
&nbsp;
{% if page.taxonomies.tags %}
{{ macros::render_tags(tags=page.taxonomies.tags) }}
{% endif %}</div>

{{ page.content | safe }}
</article>
Expand Down
3 changes: 3 additions & 0 deletions templates/blog.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ <h1 class="title">
{% for page in section.pages %}
<li>
<a href="{{ page.permalink | safe }}">{% if page.extra.display_title %}{{ page.extra.display_title | markdown(inline=true) | safe }}{% else %}{{ page.title }}{% endif %} ({{ page.date }})</a>
<div>{% if page.taxonomies.tags %}
{{ macros::render_tags(tags=page.taxonomies.tags) }}
{% endif %}</div>
<p>{{ page.summary | safe }}</p>
</li>
{% endfor %}
Expand Down
8 changes: 8 additions & 0 deletions templates/macros.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% macro render_tags(tags) %}
<span>
Tags:
{% for tag in tags %}
<a class="has-text-info-dark has-text-weight-semibold" href="{{ get_taxonomy_url(kind='tags', name=tag) }}"><span>{{tag}}</span></a>
{% endfor %}
</span>
{% endmacro %}
38 changes: 38 additions & 0 deletions templates/tags/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% extends "base.html" %}

{% block head %}
<style>
body {
font-family: Hack;
line-height: 1.5;
}
main {
text-align: left;
padding: 2ch;
}
header {
margin-bottom: 1.5rem;
}
h1 {
margin-bottom: .5rem;
}
</style>
{% endblock head %}

{% block header %}
<h1 class="title">Tags</h1>
{% endblock header %}

{% block content %}
<main>
<p class="subtitle">{{ terms | length }} tags in total</p>

<ul>
{% for tag in terms %}
<li>
<a href="{{ get_taxonomy_url(kind='tags', name=tag.name) }}">{{tag.name}}</a> - {{ tag.pages | length }}
{% endfor %}
</li>
</ul>
</main>
{% endblock content %}
49 changes: 49 additions & 0 deletions templates/tags/single.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{% extends "base.html" %}

{% block head %}
<style>
body {
font-family: Hack;
line-height: 1.5;
}
main {
width: 80ch;
padding: 2ch;
}
header {
margin-bottom: 1.5rem;
}
h1 {
margin-bottom: .5rem;
}
</style>
{% endblock head %}

{% block header %}
<header>
<h1 class="title">Tag: {{ term.name }}</h1>
</header>
{% endblock %}

{% block content %}
<main>
{% if paginator %}
{% set pages = paginator.pages %}
{% else %}
{% set pages = term.pages %}
{% endif %}

<ul>
{% for page in pages %}
<li>
<a href="{{ page.permalink | safe }}">{% if page.extra.display_title %}{{ page.extra.display_title | markdown(inline=true) | safe }}{% else %}{{ page.title }}{% endif %} ({{ page.date }})</a>
<div>{% if page.taxonomies.tags %}
{{ macros::render_tags(tags=page.taxonomies.tags) }}
{% endif %}</div>
<p>{{ page.summary | safe }}</p>
</li>
{% endfor %}
</ul>

</main>
{% endblock content %}

0 comments on commit 24f4c3f

Please sign in to comment.