aboutsummaryrefslogtreecommitdiff
path: root/templates/base.html
blob: 18e1fb4fdb1e242698620cf6d42bda16647f7b64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
{% import "macros/social.html" as social_macros %}
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  {% block title %}<title>{% if page.title %}{{ page.title }} | {% endif %}{{ config.title }}</title>{% endblock title %}

  {% if is_404 %}
    <meta name="robots" content="noindex, follow">
  {% else %}
    <meta name="robots" content="index, follow">
    <meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1">
    <meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1">
  {% endif %}
  {% if current_url %}
      {% set page_url = current_url %}
  {% else %}
      {% set page_url = get_url(path="404.html") %}
  {% endif %}
  {% if current_path %}
      {% set page_path = current_path %}
  {% else %}
      {% set page_path = "/404.html" %}
  {% endif %}

  {% block description %}
    {% if page.description %}
      <meta name="description" content="{{ page.description }}" />

      {% if config.extra.seo | default(value=true) %}
        <meta name="twitter:description" content="{{ page.description }}">
        <meta property="og:description" content="{{ page.description }}">
      {% endif %}

    {% else %}
      <meta name="description" content="{{ config.description }}" />

      {% if config.extra.seo | default(value=true) %}
        <meta name="twitter:description" content="{{ config.description}}">
        <meta property="og:description" content="{{ config.description }}">
      {% endif %}

    {% endif %}
  {% endblock description %}

  {% if page.extra.keywords %}
    <meta name="keywords" content="{{ page.extra.keywords }}, {{ config.extra.keywords }}">
  {% else %}
    <meta name="keywords" content="{{ config.extra.keywords }}">
  {% endif %}

  <meta name="author" content="{{ config.extra.author }}">
  <meta name="copyright" content="{{ config.title }}">

  {% if config.extra.google %}<meta name="google-site-verification" content="{{ config.extra.google | safe }}">{% endif %}
  {% if config.extra.bing %}<meta name="msvalidate.01" content="{{ config.extra.bing | safe}}">{% endif %}
  <meta name="referrer" content="no-referrer-when-downgrade">

  <meta name="HandheldFriendly" content="True">
  <meta name="mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="default">

  {% block css %}<link rel="stylesheet" href="{{ get_url(path="abridge.css", trailing_slash=false, cachebust=true) }}">{% endblock css %}

  {% if config.extra.favicon %}
    <link rel="shortcut icon" href="{{ get_url(path=config.extra.favicon, trailing_slash=false) }}" sizes="16x16" type="image/png"/>
  {% endif %}

  <link rel="canonical" href="{{ get_url(path="/") }}">
  {% if config.generate_feed %}<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="atom.xml") }}">{% endif %}

  {% if config.extra.seo | default(value=true) %}
    {% block ogp_head %}
      {% if page.title %}
        <meta property="og:title" content="{{ page.title }} | {{ config.title }}">
        <meta name="twitter:title" content="{{ page.title }} | {{ config.title }}">
      {% else %}
        <meta property="og:title" content="{{ config.title }}">
        <meta name="twitter:title" content="{{ config.title }}">
      {% endif %}

      <meta property="og:site_name" content="{{ config.title }}">
      <meta property="og:locale" content="en_US">
      <meta property="og:type" content="website">
      <meta property="og:updated_time" content="{{ now() }}">
    {% endblock ogp_head %}

    {% block current_url %}
      <meta property="og:url" content="{{ current_url | safe }}">
      <meta name="twitter:url" content="{{ current_url | safe }}">
    {% endblock current_url %}

    {% if config.extra.social.twitter %}
      <meta name="twitter:site" content="@{{ config.extra.twitter }}">
      <meta name="twitter:creator" content="@{{ config.extra.twitter }}">
    {% endif %}

    {% if page.extra.thumbnail %}
      <meta name="twitter:card" content="summary_large_image">
      <meta name="twitter:image" content="{{ get_url(path=page.path ~ page.extra.thumbnail, trailing_slash=false) }}">
      <meta property="og:image" content="{{ get_url(path=page.path ~ page.extra.thumbnail, trailing_slash=false) }}">
    {% elif page.extra.static_thumbnail %}
      {%if page.extra.static_thumbnail is matching("^http[s]?://") %}
        <meta name="twitter:card" content="summary_large_image">
        <meta name="twitter:image" content="{{ page.extra.static_thumbnail }}">
        <meta property="og:image" content="{{ page.extra.static_thumbnail }}">
      {% else %}
        <meta name="twitter:card" content="summary_large_image">
        <meta name="twitter:image" content="{{ get_url(path=page.extra.static_thumbnail, trailing_slash=false) }}">
        <meta property="og:image" content="{{ get_url(path=page.extra.static_thumbnail, trailing_slash=false) }}">
      {% endif %}
    {% elif config.extra.default_og_image %}
      <meta name="twitter:card" content="summary_large_image">
      <meta name="twitter:image" content="{{ get_url(path=config.extra.default_og_image, trailing_slash=false) }}">
      <meta property="og:image" content="{{ get_url(path=config.extra.default_og_image, trailing_slash=false) }}">
    {% elif config.extra.banner %}
      <meta name="twitter:card" content="summary_large_image">
      <meta name="twitter:image" content="{{ get_url(path=config.extra.banner, trailing_slash=false) }}">
      <meta property="og:image" content="{{ get_url(path=config.extra.banner, trailing_slash=false) }}">
    {% else %}
      <meta name="twitter:card" content="summary">
    {% endif %}
  {% endif %}

  {% if config.build_search_index %}
    <script type="text/javascript" src="{{ get_url(path="search_index.en.js", trailing_slash=false, cachebust=true) | safe }}" defer></script>
    <script type="text/javascript" src="{{ get_url(path="search.min.js", trailing_slash=false, cachebust=true) | safe }}" defer></script>
  {% endif %}

{% block extra_head %}{% endblock extra_head %}
</head>
<body>
{% block header %}
  <header>
    <nav>
      <header>
        <h1><a href="{{ get_url(path="/", trailing_slash=true) }}">{{ config.extra.textlogo | safe }}</a></h1>
      </header>
      <div>
        <ul>
          {% for i in config.extra.menu %}<li><h2><a href="{{ get_url(path=i.url, trailing_slash=i.slash) }}">{{ i.name }}</a></h2></li>{% endfor %}
        </ul>
      </div>
      {% if config.build_search_index %}
        <div>
          <form>
            <input id="userinput" type="search" placeholder="Search" autocomplete="off">
            <div><div id="suggestions"></div></div>
          </form>
        </div>
      {% endif %}
    </nav>
    {% if config.extra.sitedesc %}
      {% if config.description %}
        <div>{{ config.description }}</div>
      {% endif %}
    {% endif %}
    <hr>
  </header>
{% endblock header %}
<main>
{% block content %}
{% endblock content %}
</main>
{% block footer %}
  <footer>
    <hr>
    <center>
      <p>{{ social_macros::social_links(social_config=config.extra.social) }}</p>

      {# Copyright #}
      {% set copyright_start_year=config.extra.copyright_start_year | default(value="") %}
      {% if copyright_start_year %}{% set copyright_start_year=copyright_start_year ~ "-" %}{% endif %}
      {% set copyright_end_year=config.extra.copyright_end_year | default(value=now() | date(format="%Y")) %}
      <p>Copyright &copy; {{ copyright_start_year ~ copyright_end_year}} {{ config.title }}</p>

      <p>{% for i in config.extra.menu_footer %}<a href="{{ get_url(path=i.url, trailing_slash=i.slash) }}">{{ i.name }}</a> &nbsp; {% endfor %}</p>
      {# Optional footer credit #}
      {% if config.extra.footer_credit | default(value=true) %}
        <p>Powered by <a href="https://www.getzola.org/">Zola</a> and <a href="https://github.com/jieiku/abridge/">Abridge</a></p>
      {% endif %}
    </center>
  </footer>
{% endblock footer %}
</body>
</html>