Merge pull request #55 from welpo/fix/title-tag
🐛 fix: use set_title macro to set proper titles
This commit is contained in:
commit
ba0631b4e0
@ -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>
|
||||
|
29
templates/macros/set_title.html
Normal file
29
templates/macros/set_title.html
Normal file
@ -0,0 +1,29 @@
|
||||
{% macro set_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>
|
||||
|
||||
{# 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…
x
Reference in New Issue
Block a user