pelican-alchemy/alchemy/templates/base.html
Vitaly Potyarkin 5251f12a56 Use macro for URLs that may be relative to site root
There are multiple places in the theme where URL value may be either
relative to site root or pointing to a third-party resource. Separating
the handler logic into a macro makes sense.

Now BOOTSTRAP_CSS may contain paths relative to site root - that allows
users to apply custom Boostwatch themes without depending on third party
resources (custom theme may be included as static file and referenced via
relative path).
2019-10-17 18:02:36 +03:00

64 lines
2 KiB
HTML

{%- macro url(destination) -%}
{%- if destination|lower|truncate(4, True, '') == 'http' or not destination -%}
{{ destination }}
{%- elif destination|first == '/' -%}
{{ SITEURL + destination }}
{%- else -%}
{{ SITEURL + '/' + destination }}
{%- endif -%}
{%- endmacro -%}
<!doctype html>
<html lang="{{ DEFAULT_LANG }}">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>{% block title %}| {{ SITENAME }}{% endblock %}</title>
<link rel="canonical" href="{{ SITEURL }}/{{ output_file }}">
{% if RFG_FAVICONS %}
<link rel="apple-touch-icon" href="{{ SITEURL }}/apple-touch-icon.png" sizes="180x180">
<link rel="icon" type="image/png" href="{{ SITEURL }}/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="{{ SITEURL }}/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="{{ SITEURL }}/manifest.json">
<meta name="theme-color" content="#333333">
{% endif %}
<link rel="stylesheet" href="{{ url(BOOTSTRAP_CSS or '/theme/css/bootstrap.min.css') }}">
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/font-awesome.min.css">
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/pygments/{{ PYGMENTS_STYLE|default('default') }}.min.css">
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/theme.css">
{% for stylesheet in THEME_CSS_OVERRIDES or () %}
<link rel="stylesheet" href="{{ url(stylesheet) }}">
{% endfor %}
{% include 'include/xml_feeds.html' %}
{% block head %}{% endblock %}
{% include 'include/analytics.html' %}
</head>
<body>
<header class="header">
<div class="container">
{% include 'include/header.html' %}
</div>
</header>
<div class="main">
<div class="container">
<h1>{% block page_header %}{% endblock %}</h1>
<hr>
{% block content %}{% endblock %}
</div>
</div>
<footer class="footer">
<div class="container">
{% include 'include/footer.html' %}
</div>
</footer>
</body>
</html>