From 9acaba6e35c0b8438f069820380035af7bbb27b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar?= Date: Sat, 9 Sep 2023 18:31:13 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(title):=20add=20`invert=5Ftitl?= =?UTF-8?q?e=5Forder`=20config=20option=20(#142)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.toml | 4 ++++ templates/macros/set_title.html | 6 +++++- theme.toml | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/config.toml b/config.toml index 1d3cc70..2b1ba58 100644 --- a/config.toml +++ b/config.toml @@ -219,6 +219,10 @@ short_date_format = "" # Custom separator used in title tag and posts metadata (between date, time to read, and tags). separator = "•" +# Invert the order of the site title and page title in the browser tab. +# Example: true => "Blog • ~/tabi", false => "~/tabi • Blog" +invert_title_order = false + # Full path after the base URL required. So if you were to place it in "static" it would be "/favicon.png" favicon = "img/seedling.png" diff --git a/templates/macros/set_title.html b/templates/macros/set_title.html index fffdb28..a2789cb 100644 --- a/templates/macros/set_title.html +++ b/templates/macros/set_title.html @@ -32,6 +32,10 @@ {%- endif -%} {# Return the final concatenated string. #} -{{- prefix ~ separator ~ suffix -}} +{%- if config.extra.invert_title_order -%} + {{- suffix ~ separator ~ prefix -}} +{%- else -%} + {{- prefix ~ separator ~ suffix -}} +{%- endif -%} {%- endmacro set_title -%} diff --git a/theme.toml b/theme.toml index a92357d..8343ccd 100644 --- a/theme.toml +++ b/theme.toml @@ -104,6 +104,10 @@ short_date_format = "" # Custom separator used in title tag and posts metadata (between date, time to read, and tags). separator = "•" +# Invert the order of the site title and page title in the browser tab. +# Example: true => "Blog • ~/tabi", false => "~/tabi • Blog" +invert_title_order = false + # Full path after the base URL required. So if you were to place it in "static" it would be "/favicon.ico" # favicon = ""