mat.services/templates/partials/header.html

72 lines
2.8 KiB
HTML

{% import "macros/macros.html" as post_macros %}
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% set current_path = current_path | default(value="/") %}
{# Favicon #}
{% if config.extra.favicon %}
{% set favicon_ext = config.extra.favicon | split(pat=".") | last %}
<link rel="icon" type="image/{{ favicon_ext }}" href="{{ get_url(path=config.extra.favicon, cachebust=true) }}" />
{% endif %}
{# Font from cdn or disk #}
{% if config.extra.use_cdn | default(value=false) %}
{% for cdn in config.extra.cdns %}
<link href="{{ cdn.url }}" rel="stylesheet" integrity="sha384-{{ cdn.hash }}" crossorigin="anonymous">
{% endfor %}
{% else %}
<link href="{{ get_url(path='style/fonts.css', cachebust=true) }}" rel="stylesheet" />
{% endif %}
{# RSS #}
<link rel="alternate" type="application/atom+xml" title="{{ config.title }}"
href="{{ get_url(path='atom.xml', trailing_slash=false) }}">
{# Theme #}
<link rel="stylesheet" type="text/css" href="{{ get_url(path='style/theme/light.css', cachebust=true) }}" />
<link rel="stylesheet" type="text/css" href="{{ get_url(path='style/theme/dark.css', cachebust=true) }}"
media="(prefers-color-scheme: dark)" />
<link rel="stylesheet" type="text/css" media="screen" href="{{ get_url(path='style/main.css', cachebust=true) }}" />
{% if config.extra.stylesheets %}
{% for stylesheet in config.extra.stylesheets %}
<link rel="stylesheet" href="{{ get_url(path=stylesheet, cachebust=true) }}">
{% endfor %}
{% endif %}
{% if current_path == "/" %}
{% set current_title = config.title | default(value="home") %}
{% set current_description = "the personal site of mat ess" %}
{% set hero = false %}
{% else %}
{% set current_title = page.title | default(value=config.title) | default(value="post") %}
{% set current_description = page.description | default(value="from the personal site of mat ess") %}
{% set hero = page.extra.hero | default(value=false) %}
{% endif %}
{# Meta links #}
<title>{{ current_title }}</title>
<link rel="canonical" href="{{ get_url(path=current_path) }}" />
<meta name="title" content="{{ current_title }}">
<meta name="description" content="{{ current_description }}">
{# Open Graph / Facebook #}
<meta property="og:type" content="website">
<meta property="og:title" content="{{ current_title }}">
<meta property="og:description" content="{{ current_description }}">
{% if hero %}
<meta property="og:image" content="hero.png">
{% endif %}
{# Twitter #}
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:title" content="{{ current_title }}">
<meta property="twitter:description" content="{{ current_description }}">
{% if hero %}
<meta property="twitter:image" content="hero.png">
{% endif %}
</head>