zola-water/templates/index.html

65 lines
3.9 KiB
HTML

{% import "widgets.html" as widgets %}
{% set translations = section.translations | default(value=page.translations|default(value="")) %}
<!DOCTYPE html>{# TAXONOMY: no lang on 10.1 #}
<html class="no-js" lang="{{ lang | default(value=config.default_language)}}">
<head>
<meta charset="utf8">{# TAXONOMY: no section.title here #}
<title>{% block title %}{{ section.title|default(value=taxonomy.name|default(value=config.extra.title|default(value=""))) }}{% endblock %}</title>
{% if generate_rss %}<link rel="alternate" type="application/rss+xml" href="{% if lang %}{{ widgets::i18n_url(path="rss.xml") }}{% else %}{{ get_url(path="rss.xml")}}{% endif %}">
{% endif %}<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{{ get_url(path="water." ~ config.extra.color ~ ".css") }}" type="text/css">
{%- for stylesheet in config.extra.stylesheets %}
<link rel="stylesheet" href="{{ get_url(path=stylesheet) }}" type="text/css">
{%- endfor %}
</head>
<body{% if config.extra.max_width_for == "body" %} style="max-width: {{ config.extra.max_width }}"{% endif %}>
<header>
{% block header %}
{# TAXONOMY PROBLEM (not needed with Zola > 10.1) need to check if lang exists, do not display anything otherwise #}
{% if lang %}
{% if config.extra.header and config.extra.header != "disabled" %}{# TAXONOMY: no lang here #}
{% set header = get_page(path=widgets::i18n_path(path=config.extra.header, lang=lang)) %}
{{ header.content | markdown | safe }}
{% elif config.extra.header != "disabled" %}
<h1>Welcome to water theme!</h1>
<h2>Please edit config.extra.header, or override the header block in your site templates.</h2>
{% endif %}
{% if translations %}{{ widgets::translations(translations=translations) }}{% endif %}
{% if config.extra.menu and config.extra.menu != "disabled" %}
{{ widgets::menu(path=config.extra.menu) }}
{% elif config.extra.menu != "disabled" %}
<h2>Point config.extra.menu to a Markdown page and you will have a navigation menu</h2>
{% endif %}
{% else %}
<h3>Your zola version does not support translations in taxonomy templates. Please upgrade.</h3>
{% endif %}
{% endblock header %}
</header>
<main{% if config.extra.max_width_for == "main" %} style="max-width: {{ config.extra.max_width }}"{% endif %}>
{% block main %}
{# TAXONOMY: Please override me or i will crash your site #}
{% if config.extra.home_section %}
{% set home_section = config.extra.home_section ~ "/_index.md" %}
{{ widgets::section(cur_section=get_section(path=widgets::i18n_path(path=home_section)), full_articles=config.extra.home_fullarticles, title=config.extra.home_title) }}
{% else %}
{% if config.extra.home_title %}<h1 class="p-name">{{ section.title }}</h1>{% endif %}
{{ section.content | markdown | safe }}
{% endif %}
{% endblock %}
</main>
<footer>
{% block footer %}
{# TAXONOMY: no path here, so no source #}
{% set cur_path = section.path|default(value=page.path|default(value="")) %}
{% if config.extra.forge and cur_path %}
<aside class="source">
{% set translated = trans(key="source", lang=lang) %}
{% set path = widgets::strip_lang_from_path(path=cur_path, lang=lang) %}
<a href="{{ config.extra.forge.browse }}content/{{ path }}{% if section %}_{% endif %}index{% if lang != config.default_language %}.{{ lang }}{% endif %}.md">{{ translated }}</a>
</aside>
{% endif %}
{% endblock footer %}
</footer>
</body>
</html>