website/templates/base.html
Roman Tsisyk aaaac06d8e Execute npm run format
Signed-off-by: Roman Tsisyk <roman@tsisyk.com>
2025-02-22 17:05:17 +00:00

121 lines
4.3 KiB
HTML

{%- if page %}
{%- set resource = page %}
{%- set resource_title = resource.title %}
{%- set resource_path = resource.path %}
{%- elif section %}
{%- set resource = section %}
{%- set resource_title = resource.title %}
{%- set resource_path = resource.path %}
{%- elif term %}
{%- set resource = term %}{# taxonomy term has only 'name', 'slug' and 'path' properties #}
{%- set resource_path = resource.path %}
{%- set resource_title = resource.name %}
{%- elif taxonomy %}{# taxonomy has only 'name' and 'slug' properties #}
{% if lang == 'en' %}
{% set resource = taxonomy.name ~ "/_index.md" %}
{% else %}
{% set resource = taxonomy.name ~ "/_index." ~ lang ~ ".md" %}
{% endif %}
{% set resource = get_section(path=resource) %}
{%- set resource_title = resource.title %}
{%- set resource_path = resource.path %}
{%- endif %}
<!DOCTYPE html>
{%- set rtl_langs = ["ar", "arc", "dv", "fa", "ha", "he", "khw", "ks", "ku", "ps", "ur", "yi"] -%}
<html lang="{{ lang }}" {%- if lang in rtl_langs -%} dir="rtl" {%- endif -%}>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
{% block meta_description -%}
{%- if resource.description -%}
{% set description = resource.description %}
{% elif resource.content -%}
{% set description = resource.content | trim | striptags | linebreaksbr | safe | replace(from="<br>", to=" ") | replace(from=" ", to=" ") | replace(from=" ", to=" ") | replace(from=" ", to=" ") | truncate(length=160) %}
{% endif -%}
{%- if description -%}
<meta name="description" content="{{ description }}">
{% endif -%}
{%- endblock -%}
{% block rss -%}
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml", trailing_slash=false) }}">
{% endblock -%}
<link rel="canonical" href="{{ config.base_url | safe }}{{ resource_path | safe }}">
{%- set preview_image = 'images/screenshots/prague.jpg' -%}
{%- if resource.extra.preview_image -%}
{%- set preview_image = resource.extra.preview_image -%}
{%- elif resource.assets %}
{%- set basename = resource.assets[0] | split(pat='/') | last %}
{%- if basename is ending_with('.jpg') or basename is ending_with('.jpeg') or basename is ending_with('.png') or basename is ending_with('.webp') %}
{%- set preview_image = resource_path ~ basename -%}
{%- endif %}
{%- endif %}
<meta property="og:image" content="{{ get_url(path=preview_image) }}">
{# TODO: Add og:video support #}
<meta property="og:url" content="{{ current_url | safe }}">
<meta property="og:type" content="website">
<meta property="og:title" content="{{ resource_title }}">
{%- if description %}
<meta property="og:description" content="{{ description }}">
{%- endif -%}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="{{ resource_title }}">
{%- if description %}
<meta name="twitter:description" content="{{ description }}">
{%- endif %}
<meta name="apple-itunes-app" content="app-id=1567437057">
<meta name="wikidata" content="Q107078602">
{% if resource.date -%}
<meta property="article:published_time" content="{{ resource.date }}">
{%- endif -%}
<meta name="generator" content="Zola">
{%- block meta -%}{%- endblock %}
<link href="{{ get_url(path="main.css", cachebust=true) }}" rel="stylesheet" type="text/css">
<title>{{ resource_title }}</title>
{%- if lang == config.default_language %}
{% include 'language_redirect.html' %}
{% endif -%}
</head>
<body>
<header>
{% include 'top_menu.html' %}
</header>
<main>
{% if page.taxonomies and page.taxonomies.faq %}{# Show FAQ breadcrumbs #}
{% include 'faq/faq-breadcrumbs.html' %}
{% endif %}
{% block content %}{% endblock %}
</main>
<footer>
{% if page.taxonomies and page.taxonomies.faq %}{# Show FAQ editing link #}
{% include 'faq/github_edit_link.html' %}
{% endif %}
{% include 'bottom_menu.html' %}
<p>
<span data-nosnippet>© 2024 <a href="mailto:legal@organicmaps.app">Organic Maps OÜ</a>, reg. code 16225385</span>
<span data-nosnippet>Harju maakond, Tallinn, Kesklinna linnaosa, Rävala pst 8-810, 10143, Estonia</span>
</p>
</footer>
</body>
</html>