satchlj.com/themes/zenn/templates/site.html

262 lines
12 KiB
HTML

{% import "post_macros.html" as post_macros %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="HandheldFriendly" content="True">
<link rel="icon" type="image/png" href="/favicon.png" />
<meta name="application-name" content="{{ config.title }}" />
<meta name="author" content="{{ config.extra.author }}" />
{% if page.title -%}
<meta name="title" content="{{ page.title }}" />
<meta name="og:title" content="{{ page.title }}" />
{%- elif section.title -%}
<meta name="title" content="{{ section.title }}" />
<meta name="og:title" content="{{ section.title }}" />
{%- else -%}
<meta name="title" content="{{ config.title }}" />
<meta name="og:title" content="{{ config.title }}" />
{%- endif %}
{% if page.description -%}
<meta name="description" content="{{ page.description }}" />
<meta name="og:description" content="{{ page.description }}" />
{%- elif section.description -%}
<meta name="description" content="{{ section.description }}" />
<meta name="og:description" content="{{ section.description }}" />
{%- else -%}
<meta name="description" content="{{ config.description }}" />
<meta name="og:description" content="{{ config.description }}" />
{%- endif %}
{% if page.permalink -%}
<meta name="og:permalink" content="{{ page.permalink }}" />
{%- elif section.permalink -%}
<meta name="og:permalink" content="{{ section.permalink }}" />
{%- endif %}
{% set keywords = [] -%}
{%- if page.taxonomies.tags -%}
{% set_global keywords = page.taxonomies.tags %}
{%- endif -%}
{%- if keywords | length == 0 -%}
{%- set tags = get_taxonomy(kind="tags") -%}
{%- if tags.items | length > 0 -%}
{%- for tag in tags.items -%}
{%- set_global keywords = keywords | concat(with=tag.name) -%}
{%- endfor -%}
{%- endif -%}
{%- endif -%}
{%- if keywords | length > 0 -%}
<meta name="keywords" content="{{ keywords | join(sep=",") }}"/>
{%- endif %}
<title>
{%- block title -%}
{%- if page.title -%}
{{ page.title }}{{ " · " }}
{%- endif -%}
{%- if section.title -%}
{{ section.title }}{{ " · " }}
{%- endif -%}
{{ config.title }}
{%- endblock title -%}
</title>
{% block css -%}
<link id="style-dark" rel="stylesheet" href="{{ get_url(path="site_dark.css", trailing_slash=false) | safe }}">
<link id="style-light" disabled rel="stylesheet" href="{{ get_url(path="site_light.css", trailing_slash=false) | safe }}">
{%- if page.extra.zenn_applause -%}
<link rel="stylesheet" href="{{ get_url(path="vendor/applause-button/applause-button.css", trailing_slash=false) | safe }}">
{%- endif -%}
{%- endblock css %}
{% block js -%}
<script src="{{ get_url(path="js/theme.js", trailing_slash=false) | safe }}"></script>
{%- if page.extra.zenn_applause -%}
<script src="{{ get_url(path="vendor/applause-button/applause-button.js", trailing_slash=false) | safe }}"></script>
{%- endif -%}
{%- endblock js %}
{% if config.generate_rss -%}
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml") | safe }}">
{%- endif %}
{%- block extra_head %}
{% endblock extra_head %}
</head>
<body class="notransition">
{% if config.extra.zenn_title -%}
{% block header %}
<header id="banner">
<a href="/" class="logo">{{ config.extra.zenn_title }}</a>
{% if config.extra.zenn_menu -%}
<section id="navbar" class="navbar">
<ul>
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
{% for item in config.extra.zenn_menu %}
<li>
<a itemprop="url"
class="{% if item.url | replace(from="$BASE_URL", to=config.base_url) == current_url %}active{% endif %}"
href="{{ item.url | safe | replace(from="$BASE_URL", to=config.base_url) }}">
<span itemprop="name">{{ item.name }}</span>
</a>
</li>
{% endfor %}
</nav>
</ul>
</section>
{%- endif %}
<section class="actions">
<a href="#" class="theme-toggle" onclick="theme_toggle(); return false;" title="Toggle light/dark mode">
{{ load_data(path="static/icons/glyphicons-halflings-51-contrast.svg") | safe -}}
</a>
<a href="#" class="navbar-toggle" onclick="navbar_toggle(); return false;" title="Show/hide navbar">
{{ load_data(path="static/icons/glyphicons-halflings-227-menu.svg") | safe -}}
</a>
</section>
</header>
{% endblock header %}
{%- endif -%}
{% block main %}
<main>
<content>
{% if section.title -%}
<header>
<h1>
{{ section.title }}
{%- if paginator -%}
{% if paginator.current_index > 1 %}
&nbsp;&middot;&nbsp; Page {{ paginator.current_index }}
{% endif %}
{%- endif -%}
{%- include "anchor-link.html" -%}
</h1>
{%- if not section.extra.zenn_hide_header_meta -%}
{%- block header_meta -%}{%- endblock header_meta -%}
{%- endif %}
</header>
{%- endif %}
{% if page.title -%}
<header>
<h1>
{{ page.title }}
{%- include "anchor-link.html" -%}
</h1>
{%- if not page.extra.zenn_hide_header_meta -%}
{%- block header_meta -%}{%- endblock header_meta -%}
{%- endif %}
</header>
{%- endif %}
{% block body -%}{%- endblock body %}
{% block page_footer %}{% endblock page_footer %}
</content>
<sidebar>
{% if config.extra.zenn_menu -%}
<section>
<ul>
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
{% for item in config.extra.zenn_menu %}
<li>
<a itemprop="url"
class="{% if item.url | replace(from="$BASE_URL", to=config.base_url) == current_url %}active{% endif %}"
href="{{ item.url | safe | replace(from="$BASE_URL", to=config.base_url) }}">
<span itemprop="name">{{ item.name }}</span>
</a>
</li>
{% endfor %}
</nav>
</ul>
</section>
{%- endif %}
{# Table of contents #}
{% if toc -%}
<section>
<h1>Contents</h1>
<ul>
<li><a href="{{ current_url }}#">{{ page.title }}</a></li>
{% for h1 in toc %}
<li>
<a href="{{ h1.permalink | safe }}">{{ loop.index }}. {{ h1.title }}</a>
{% if h1.children %}
{# <ul> #}
{% for h2 in h1.children %}
<li class="sub">
<a href="{{h2.permalink | safe}}">{{ loop.index }}. {{ h2.title }}</a>
</li>
{% endfor %}
{# </ul> #}
{% endif %}
</li>
{% endfor %}
</ul>
</section>
{%- endif %}
{# Categories #}
{% set categories = get_taxonomy(kind="categories") %}
{% if categories.items | length > 0 -%}
<section>
<h1><a href="/categories">Categories</a></h1>
<ul>
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
{% for category in categories.items %}
<li>
<a itemprop="url"
class="{% if category.permalink | replace(from="$BASE_URL", to=config.base_url) == current_url %}active{% endif %}"
href="{{ category.permalink | safe }}">
<span itemprop="name">{{ category.name | title }}</span>
</a>
</li>
{% endfor %}
</nav>
</ul>
</section>
{%- endif %}
{# Tags #}
{% set tags = get_taxonomy(kind="tags") -%}
{% if tags.items | length > 0 -%}
<section>
<h1><a href="/tags">Tags</a></h1>
<div class="tags">
{% for tag in tags.items %}
<a href="{{ tag.permalink | safe }}"
class="tag {% if tag.permalink | replace(from="$BASE_URL", to=config.base_url) == current_url %}active{% endif %}">
{{ tag.name }}
</a>
{% endfor %}
</div>
</section>
{%- endif %}
<p class="muted">
Copyright &copy; {{ config.title }} {{ now() | date(format="%Y") }}
{% if config.extra.zenn_source %}
<br /><a href="{{ config.extra.zenn_source }}" target="_blank">Source</a>
{% endif %}
</p>
</sidebar>
</main>
{% endblock main %}
</body>
</html>