From 3abae6b1530004dfdfde491bcd0f8aeed7951d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Stiki=C4=87?= Date: Sat, 20 Jul 2024 11:36:22 +0800 Subject: [PATCH 1/4] Add mastodon support --- README.md | 59 ++++++++++++++++++++++++++++++++++---- templates/index.html | 4 +++ templates/macros/head.html | 4 +++ 3 files changed, 61 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 586b50c..979a3a1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + # Terminimal [![Build Status](https://github.com/pawroman/zola-theme-terminimal/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/pawroman/zola-theme-terminimal/actions/workflows/pages/pages-build-deployment) @@ -10,6 +11,7 @@ https://pawroman.github.io/zola-theme-terminimal/ Tested with Zola v0.17.2. Please note that earlier versions might not work because of breaking changes across Zola versions. + #### Fork disclaimer This theme is a fork (not a port) of "Terminal" Hugo theme @@ -21,6 +23,37 @@ Many thanks for that outstanding original theme, Radek! For more information about this fork and the differences to the original theme, please see: [Changes compared to the original theme](#changes-compared-to-the-original-theme) below. + +## Table of contents + +- [Versioning](#versioning) +- [How to start](#how-to-start) +- [Shortcodes](#shortcodes) + - [`image`](#image) + - [`figure`](#figure) +- [Features](#features) + - [OpenGraph](#opengraph) + - [Mastodon](#mastodon) +- [Configuration](#configuration) + - [Only show the post's description](#only-show-the-posts-description) + - [Colors](#colors) + - [Logo text and link](#logo-text-and-link) + - [Author and copyright](#author-and-copyright) + - [Menu](#menu) + - [Tags](#tags) + - [Pagination](#pagination) + - [Language code](#language-code) + - [Hack font subset](#hack-font-subset) + - [Favicon](#favicon) + - [Page titles](#page-titles) +- [Extending](#extending) +- [How to contribute](#how-to-contribute) +- [Changes compared to the original theme](#changes-compared-to-the-original-theme) + - [New features](#new-features) + - [Features retained from the original](#features-retained-from-the-original) +- [License](#license) + + ## Versioning This theme used to be non-versioned, e.g. you'd pull the master branch, and occasionally new features or fixes would @@ -81,7 +114,7 @@ Example: {{ image(src="/img/hello.png", alt="Hello Friend", position="left", style="border-radius: 8px;") }} ``` - + ### `figure` Same as `image`, but with a few extra optional arguments: @@ -101,7 +134,9 @@ Example: caption_style="font-style: italic;") }} ``` -## OpenGraph +## Features + +### OpenGraph To add an image to a post, set the `og_image` extra option to the desired image in the same directory of the markdown file: @@ -119,6 +154,16 @@ Additionally, for the section pages and for posts to have a fallback image, add default_og_image = "static/ocean.jpg" ``` +### Mastodon + +To enable [Mastodon verification](https://docs.joinmastodon.org/user/profile/#verification), add +the following to your `config.toml`: + +```toml +[extra] +mastodon_url = "https://hachyderm.io/@opeik" +``` + ## Configuration ### Only show the post's description @@ -187,7 +232,7 @@ You can set the footer's copyright author name like this: # copyright text. Apart from author, it will # contain current year and a link to the theme. author = "My Name" -``` +``` If you don't like the default copyright text, you can set it to completely custom HTML: @@ -216,13 +261,13 @@ menu_items = [ # each of these is optional, name and url are required # $BASE_URL is going to be substituted by base_url from configuration {name = "blog", url = "$BASE_URL"}, - + # tags should only be enabled if you have "tags" taxonomy # see documentation below for more details {name = "tags", url = "$BASE_URL/tags"}, {name = "archive", url = "$BASE_URL/archive"}, {name = "about me", url = "$BASE_URL/about"}, - + # set newtab to true to make the link open in new tab {name = "github", url = "url-to-your-github", newtab = true}, ] @@ -239,7 +284,7 @@ taxonomies = [ ] ``` -Enabling tags will create a new `/tags` page, and +Enabling tags will create a new `/tags` page, and cause them to show up in `archive` section. Note that you still need to create a menu link to the tags page manually. @@ -426,3 +471,5 @@ for more information. The license for Hack fonts used is included in [LICENSE-Hack.md](../master/LICENSE-Hack.md). + +[utterances]: https://utteranc.es/ diff --git a/templates/index.html b/templates/index.html index 8b67c98..22f7c4c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -26,6 +26,10 @@ {% endif -%} + {%- if config.extra.mastodon_url %} + {%- block mastodon %}{{ head_macros::mastodon(config=config) }}{% endblock mastodon -%} + {% endif -%} + {%- block extra_head %} {% endblock extra_head -%} diff --git a/templates/macros/head.html b/templates/macros/head.html index d882e0c..5451756 100644 --- a/templates/macros/head.html +++ b/templates/macros/head.html @@ -92,3 +92,7 @@ {% endmacro open_graph %} + +{% macro mastodon(config) %} + +{% endmacro mastodon %} From d0bb9da1d1b44035d56f0ea6892c9ce02c6d95b2 Mon Sep 17 00:00:00 2001 From: Heitor Pascoal de Bittencourt Date: Mon, 12 Aug 2024 16:36:10 -0300 Subject: [PATCH 2/4] templates/index: fix broken RSS/ATOM feed rel links Zola 0.19.0 changed the config options related to RSS/ATOM feed generation, allowing multiple feeds at once. This patch addresses this change and adds as many links in the HTML head as there are feeds. Fix #64 --- templates/index.html | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/templates/index.html b/templates/index.html index 8b67c98..5f7a208 100644 --- a/templates/index.html +++ b/templates/index.html @@ -13,13 +13,17 @@ {%- block open_graph %}{{ head_macros::open_graph(config=config) }}{% endblock open_graph -%} - {%- if config.generate_feed %} - {%- if "rss" in config.feed_filename %} - {% set feed_type = 'rss+xml' %} - {%- else %} - {% set feed_type = 'atom+xml' %} - {% endif -%} - + {%- if config.generate_feeds %} + {%- for feed in config.feed_filenames %} + {%- if feed is containing('atom') %} + + {%- endif %} + + {%- if feed is containing('rss') %} + + {%- endif %} + + {%- endfor %} {% endif -%} {%- if config.extra.favicon %} From 26ab720d511c1c4434c931a08f0dfb3e54076fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Romanowski?= Date: Sat, 17 Aug 2024 17:48:30 +0200 Subject: [PATCH 3/4] Tweak default config to reflect changes in RSS generation after Zola 0.19 changes --- README.md | 4 +++- config.toml | 4 ++-- templates/index.html | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 586b50c..b8fc4b7 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ See the live demo (of the default configuration) here: https://pawroman.github.io/zola-theme-terminimal/ -Tested with Zola v0.17.2. Please note that earlier versions might not work because of breaking changes across Zola versions. +Tested with Zola v0.19.2. + +Please note that earlier (and older) versions might not work because of breaking changes across Zola versions. #### Fork disclaimer diff --git a/config.toml b/config.toml index cfcceca..b03451a 100644 --- a/config.toml +++ b/config.toml @@ -6,10 +6,10 @@ title = "Zola Terminimal theme" compile_sass = true # The theme supports feeds (RSS and ATOM) -generate_feed = true +generate_feeds = true # Use `rss.xml` for RSS feeds and `atom.xml` for ATOM. -feed_filename = "atom.xml" +feed_filenames = ["rss.xml", "atom.xml"] # Optional: enable tags taxonomies = [ diff --git a/templates/index.html b/templates/index.html index 5f7a208..fd07b4c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -24,7 +24,7 @@ {%- endif %} {%- endfor %} - {% endif -%} + {%- endif -%} {%- if config.extra.favicon %} From ec2fe73ec8f34849feb5a05537aa85d62c0f77fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Stiki=C4=87?= Date: Sat, 24 Aug 2024 10:34:08 +0800 Subject: [PATCH 4/4] wip --- README.md | 24 ++++++++++++++++++------ templates/index.html | 4 ++++ templates/macros/head.html | 4 ++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b8fc4b7..2053460 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Example: {{ image(src="/img/hello.png", alt="Hello Friend", position="left", style="border-radius: 8px;") }} ``` - + ### `figure` Same as `image`, but with a few extra optional arguments: @@ -103,7 +103,9 @@ Example: caption_style="font-style: italic;") }} ``` -## OpenGraph +## Features + +### OpenGraph To add an image to a post, set the `og_image` extra option to the desired image in the same directory of the markdown file: @@ -121,6 +123,16 @@ Additionally, for the section pages and for posts to have a fallback image, add default_og_image = "static/ocean.jpg" ``` +### Mastodon + +To enable [Mastodon verification](https://docs.joinmastodon.org/user/profile/#verification), add +the following to your `config.toml`: + +```toml +[extra] +mastodon_url = "https://hachyderm.io/@my_username_here" +``` + ## Configuration ### Only show the post's description @@ -189,7 +201,7 @@ You can set the footer's copyright author name like this: # copyright text. Apart from author, it will # contain current year and a link to the theme. author = "My Name" -``` +``` If you don't like the default copyright text, you can set it to completely custom HTML: @@ -218,13 +230,13 @@ menu_items = [ # each of these is optional, name and url are required # $BASE_URL is going to be substituted by base_url from configuration {name = "blog", url = "$BASE_URL"}, - + # tags should only be enabled if you have "tags" taxonomy # see documentation below for more details {name = "tags", url = "$BASE_URL/tags"}, {name = "archive", url = "$BASE_URL/archive"}, {name = "about me", url = "$BASE_URL/about"}, - + # set newtab to true to make the link open in new tab {name = "github", url = "url-to-your-github", newtab = true}, ] @@ -241,7 +253,7 @@ taxonomies = [ ] ``` -Enabling tags will create a new `/tags` page, and +Enabling tags will create a new `/tags` page, and cause them to show up in `archive` section. Note that you still need to create a menu link to the tags page manually. diff --git a/templates/index.html b/templates/index.html index fd07b4c..d2bf2b0 100644 --- a/templates/index.html +++ b/templates/index.html @@ -30,6 +30,10 @@ {% endif -%} + {%- if config.extra.mastodon_url %} + {%- block mastodon %}{{ head_macros::mastodon(config=config) }}{% endblock mastodon -%} + {% endif -%} + {%- block extra_head %} {% endblock extra_head -%} diff --git a/templates/macros/head.html b/templates/macros/head.html index d882e0c..5451756 100644 --- a/templates/macros/head.html +++ b/templates/macros/head.html @@ -92,3 +92,7 @@ {% endmacro open_graph %} + +{% macro mastodon(config) %} + +{% endmacro mastodon %}