blog/templates/base.html
2024-11-16 02:03:03 -03:00

106 lines
5.3 KiB
HTML

{%- if page %}
{%- set translation_count = page.translations | length %}
{%- elif section %}
{%- set translation_count = section.translations | length %}
{%- endif -%}
<!DOCTYPE html>
{%- if lang == "pt" %}
<html lang="pt-BR" id="theme">
{%- else %}
<html lang="{{ lang }}" id="theme">
{%- endif %}
<head prefix="og: https://ogp.me/ns/website#">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{%- set title_tail = " ~ " ~ config.title %}
{%- if page.title %}
{%- set title = page.title ~ title_tail %}
{%- elif section.title %}
{%- set title = section.title ~ title_tail %}
{%- else %}
{%- set title = config.title %}
{%- endif %}
<title>{{ title }}</title>
<link href="{{ get_url(path="assets/css/style.css", trailing_slash=false) }}" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{{ get_url(path="assets/css/syntax-dark.css", trailing_slash=false) }}" media="(prefers-color-scheme: dark)" />
<link rel="stylesheet" type="text/css" href="{{ get_url(path="assets/css/syntax-light.css", trailing_slash=false) }}" media="(prefers-color-scheme: light)" />
<link rel="icon" type="image/png" sizes="36x36" href="{{ get_url(path="assets/img/icons/kitty/kitty_32.png", trailing_slash=false) }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ get_url(path="assets/img/icons/kitty/kitty_16.png", trailing_slash=false) }}">
<link rel="icon" type="image/png" sizes="128x128" href="{{ get_url(path="assets/img/icons/kitty/kitty_circle_128.png", trailing_slash=false) }}">
{%- set description = page.content | default(value=config.description) | striptags | regex_replace(pattern="\n", rep=" ") | truncate(length=120) %}
<meta property="og:title" content="{{ title }}" />
<meta property="og:description" content="{{ description }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ current_url | default(value= get_url(path="/")) | safe }}" />
<meta property="og:image" content="{{ get_url(path="assets/img/icons/kitty/kitty_circle_192.png") }}" />
{% block rss -%}
{%- if lang == "pt" %}
{%- set locale_all_content = "Todo o conteúdo" %}
{%- set locale_language_name = "Português" %}
{% else %}
{%- set locale_all_content = "All content" %}
{%- set locale_language_name = "English" %}
{%- endif -%}
<link rel="alternate" type="application/rss+xml" title="{{ locale_all_content }} ({{ locale_language_name }})" href="{{ get_url(path="atom.xml", lang=lang, trailing_slash=false) }}">
<link rel="alternate" type="application/rss+xml" title="Posts ({{ locale_language_name }})" href="{{ get_url(path="posts/atom.xml", lang=lang, trailing_slash=false) }}">
<link rel="alternate" type="application/rss+xml" title="{% if lang == "pt" %}Notas{% else %}Notes{% endif %} ({{ locale_language_name }})" href="{{ get_url(path="notes/atom.xml", lang=lang, trailing_slash=false) }}">
<link rel="alternate" type="application/rss+xml" title="Links" href="{{ get_url(path="links/atom.xml", trailing_slash=false) }}">
{%- endblock %}
{%- block extra_head %}{% endblock %}
</head>
<body>
{%- if lang == "pt" %}
<a id="skip-to-main" href="#main">Saltar para o conteúdo</a>
{%- else %}
<a id="skip-to-main" href="#main">Skip to content</a>
{% endif -%}
{% block header %}{% endblock %}
<div id="user-controls" class="{% if current_path and (current_path == "/" or current_path == "pt/" ) %}index-user-controls{% else %}subpage-user-controls{% endif %}">
<nav id="nav-menu">
<ul>
{%- if lang == "pt" %}
<li><a id="home" href="{{ get_url(path="/pt") }}">Início</a></li>
{%- else %}
<li><a id="home" href="{{ get_url(path="/") }}">Home</a></li>
{%- endif %}
<li><a href="{{ get_url(path="posts", lang=lang) }}">Posts</a></li>
<li><a href="{{ get_url(path="notes", lang=lang) }}">{% if lang == "pt" %}Notas{% else %}Notes{% endif %}</a></li>
<li><a href="{{ get_url(path="links", lang=lang) }}">Links</a></li>
<li><a href="{{ get_url(path="feeds", lang=lang) }}">RSS</a></li>
<li><a href="https://mastodon.bsd.cafe/@jutty">Mastodon</a></li>
</ul>
</nav>
{% if current_path and translation_count > 1 %}
{%- set slashless_current_path = current_path | regex_replace(pattern="^\/", rep="") %}
{%- set english_path = current_path | regex_replace(pattern="pt\/", rep="") %}
<div id="language-selector">
<figure id="language-icon">
<img src="{{ get_url(path="assets/img/icons/language.svg") }}"
alt="{% if lang == "pt" %}Ícone de idioma{% else %}Language icon{% endif %}"/>
</figure>
{%- if lang == "pt" %}<a href="{{ get_url(path=english_path) }}">EN</a>{% else %}<a href="{{ get_url(path=slashless_current_path, lang="pt") }}">PT</a>
{%- endif %}
</div>
{%- endif %}
</div>
<main id="main">
{%- block content %}{% endblock %}
</main>
<footer>
{%- block footer %}{% endblock -%}
</footer>
</body>
</html>