🐛 fix: use set_title macro to set proper titles

Fixes #33
main
welpo 2 years ago
parent 872992b426
commit 53d2624133
No known key found for this signature in database
GPG Key ID: A2F978CF4EC1F5A6

@ -5,6 +5,7 @@
{% import "macros/content.html" as macros_content %}
{% import "macros/cards_posts.html" as macros_cards_posts %}
{% import "macros/list_title.html" as macros_list_title %}
{% import "macros/set_title.html" as macros_set_title %}
<!DOCTYPE html>

@ -0,0 +1,29 @@
{% macro set_title(title) %}
{# Setup. #}
{% set prefix = config.title | safe %}
{% set separator = " • " %}
{% if current_path and current_path == "/" %}
{% set suffix = "" %}
{% set separator = "" %}
{% elif title %}
{% set suffix = title %}
{% elif section.title %}
{% set suffix = section.title %}
{% elif page.title %}
{% set suffix = page.title %}
{% elif term.name %}
{# Individual tags. #}
{% set suffix = term.name ~ " tag" %}
{% elif taxonomy.name %}
{# List of tags. #}
{% set suffix = taxonomy.name | capitalize %}
{% else %}
{% set suffix = "Lost?" %}
{% endif %}
{# Return the final concatenated string. #}
{{ prefix ~ separator ~ suffix}}
{% endmacro page_header %}

@ -4,30 +4,18 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{# Site title #}
{% set current_path = current_path | default(value="/") %}
{% if current_path == "/" %}
<title>
{{ config.title | default(value="Home") }}
</title>
{% else %}
<title>
{{ page.title | default(value=config.title) | default(value="Post") }}
</title>
{% endif %}
<title>{{ macros_set_title::set_title(title="") }}</title>
{# Favicon #}
{% if config.extra.favicon %}
<link rel="icon" type="image/png" href={{ config.extra.favicon }} />
{% endif %}
{# RSS #}
<link rel="alternate" type="application/atom+xml" title="{{ config.title }}" href="{{ get_url(path="atom.xml",
trailing_slash=false) }}">
<link rel="stylesheet" type="text/css" media="screen" href={{ get_url(path="main.css" ) }} />
{% if config.extra.stylesheets %}
{% for stylesheet in config.extra.stylesheets %}
<link rel="stylesheet" href="{{ get_url(path=stylesheet) }}">

Loading…
Cancel
Save