aboutsummaryrefslogtreecommitdiff
path: root/theme/custom/base.html
blob: 3e9f42bd3b8102e2a073a3fadfe87412f054d3be (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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
{% if 'jinja2.ext.i18n' not in JINJA_ENVIRONMENT.extensions and 'jinja2.ext.i18n' not in JINJA_EXTENSIONS %}
  {%- macro _(msg) -%}
    {{ msg % kwargs }}
  {%- endmacro -%}
{% endif %}

<!DOCTYPE html>
<html lang="{{ DEFAULT_LANG }}">
<head>

  <script>
    const theme = localStorage.getItem('theme');
	if (theme === "dark") {
		document.documentElement.setAttribute('data-theme', 'dark');
    } else {
		document.documentElement.setAttribute('data-theme', 'light');
    }

    function modeSwitcher() {
    	let currentMode = document.documentElement.getAttribute('data-theme');
    	if (currentMode === "dark") {
    		document.documentElement.setAttribute('data-theme', 'light');
    		window.localStorage.setItem('theme', 'light');
    	} else {
    		document.documentElement.setAttribute('data-theme', 'dark');
    		window.localStorage.setItem('theme', 'dark');
    	}
    }
  </script>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="HandheldFriendly" content="True" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  {% if page in hidden_pages %}
    <meta name="robots" content="noindex, nofollow" />
  {% else %}
    <meta name="robots" content="{{ ROBOTS }}" />
  {% endif %}

  {% if USE_GOOGLE_FONTS != False %}
  <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,400;0,700;1,400&family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet">
  {% endif %}

  {% if USE_LESS %}
    <link rel="stylesheet/less" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/stylesheet/style.less">
    <script src="//cdnjs.cloudflare.com/ajax/libs/less.js/2.5.1/less.min.js" type="text/javascript"></script>
  {% else %}
    <link rel="stylesheet" title="default theme" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/stylesheet/style.min.css">
  {% endif %}

  {# DARK THEME STYLES #}
  {% if THEME_COLOR == "dark" or THEME_COLOR_AUTO_DETECT_BROWSER_PREFERENCE or THEME_COLOR_ENABLE_USER_OVERRIDE %}
    <link id="dark-theme-style" rel="stylesheet" type="text/css"
      {% if THEME_COLOR_AUTO_DETECT_BROWSER_PREFERENCE %}
        {% if THEME_COLOR|default("light") == "dark" %}
          media="(prefers-color-scheme: dark), (prefers-color-scheme: no-preference)"
        {% else %}
          media="(prefers-color-scheme: dark)"
        {% endif %}
      {% elif THEME_COLOR_ENABLE_USER_OVERRIDE and THEME_COLOR|default("light") == "light" %}
        disabled="disabled"
      {% endif %}
    href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/stylesheet/dark-theme.min.css">
  {% endif %}

  {# PYGMENTS STYLES #}
  {% if THEME_COLOR_AUTO_DETECT_BROWSER_PREFERENCE or THEME_COLOR_ENABLE_USER_OVERRIDE or THEME_COLOR == "dark" %}
    <link id="pygments-dark-theme" rel="stylesheet" type="text/css"
          {% if THEME_COLOR_AUTO_DETECT_BROWSER_PREFERENCE %}
            {% if THEME_COLOR|default("light") == "dark" %}
              media="(prefers-color-scheme: dark), (prefers-color-scheme: no-preference)"
            {% else %}
              media="(prefers-color-scheme: dark)"
            {% endif %}
          {% elif THEME_COLOR_ENABLE_USER_OVERRIDE and THEME_COLOR|default("light") == "light" %}
            disabled="disabled"
          {% endif %}
          href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/pygments/{{ PYGMENTS_STYLE_DARK or PYGMENTS_STYLE or 'monokai' }}.min.css">
  {% endif %}
  {% if THEME_COLOR_AUTO_DETECT_BROWSER_PREFERENCE or not THEME_COLOR or THEME_COLOR == "light" %}
    <link id="pygments-light-theme" rel="stylesheet" type="text/css"
          {% if THEME_COLOR_AUTO_DETECT_BROWSER_PREFERENCE %}
            {% if THEME_COLOR|default("light") == "dark" %}
              media="(prefers-color-scheme: light)"
            {% else %}
              media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
            {% endif %}
          {% endif %}
          href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/pygments/{{ PYGMENTS_STYLE|default('github') }}.min.css">
  {% endif %}

  {% if PLUGINS and 'tipue_search' in PLUGINS %}
    <script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/jquery.min.js"></script>
    <script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/tipuesearch.min.js"></script>
    <script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/tipuesearch.min.js"></script>
    <script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/tipuesearch_set.min.js"></script>
    <script src="{{ SITEURL }}/tipuesearch_content.js"></script>
    <link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/tipuesearch.min.css" />
  {% endif %}

  <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/font-awesome/css/fontawesome.css">
  <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/font-awesome/css/brands.css">
  <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/font-awesome/css/solid.css">

  {% if CUSTOM_CSS %}
    <link href="{{ SITEURL }}/{{ CUSTOM_CSS }}" rel="stylesheet">
  {% endif %}

  {% if FEED_ALL_ATOM %}
    <link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Atom">
  {% endif %}

  {% if FEED_ALL_RSS %}
    <link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS">
  {% endif %}

  {% if FAVICON %}
    <link rel="shortcut icon" href="{{ FAVICON }}" type="image/x-icon">
    <link rel="icon" href="{{ FAVICON }}" type="image/x-icon">
  {% endif %}

  {% if GOOGLE_ANALYTICS %}
    {% include "partial/ga.html" %}
  {% endif %}
  
  {% if GOOGLE_GLOBAL_SITE_TAG %}
    {% include "partial/ggst.html" %}
  {% endif %}

  {% if BROWSER_COLOR %}
    <!-- Chrome, Firefox OS and Opera -->
    <meta name="theme-color" content="{{ BROWSER_COLOR }}">
    <!-- Windows Phone -->
    <meta name="msapplication-navbutton-color" content="{{ BROWSER_COLOR }}">
    <!-- iOS Safari -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <!-- Microsoft EDGE -->
    <meta name="msapplication-TileColor" content="{{ BROWSER_COLOR }}">
  {% endif %}

  {% if REL_CANONICAL %}
    {% if page %}
      <link rel="canonical" href="{{ SITEURL }}/{{ page.url }}">
    {% elif article %}
      <link rel="canonical" href="{{ SITEURL }}/{{ article.url }}">
    {% elif page_name == 'index' and not articles_previous_page %}
      <link rel="canonical" href="{{ SITEURL }}">
    {% elif author or category or tag or page_name == 'index' %}
      <link rel="canonical" href="{{ SITEURL }}/{{ articles_page.url }}">
    {% else %}
      <link rel="canonical" href="{{ SITEURL }}/{{ output_file }}">
    {% endif %}
  {% endif %}
  {% block meta %}
    <meta name="author" content="{{ AUTHOR }}" />
    <meta name="description" content="{{ SITEDESCRIPTION }}" />
    {% include "partial/og.html" %}
  {% endblock %}

  <title>{{ SITENAME }}{% block title %}{% endblock %}</title>

  {% if GOOGLE_ADSENSE and GOOGLE_ADSENSE.page_level_ads %}
  <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  <script>
    (adsbygoogle = window.adsbygoogle || []).push({
      google_ad_client: "{{ GOOGLE_ADSENSE.ca_id }}",
      enable_page_level_ads: true
    });
  </script>
  {% endif %}
  {% if GOOGLE_TAG_MANAGER %}
    {% include "partial/gtm.html" %}
  {% endif %}
</head>
<body {% if not THEME_COLOR_AUTO_DETECT_BROWSER_PREFERENCE %}class="{{ THEME_COLOR|default('light') }}-theme"{% endif %}>
  {% if GOOGLE_TAG_MANAGER %}
    {% include "partial/gtm_noscript.html" %}
  {% endif %}
  <aside>
    <div>
      <a href="{{ SITEURL }}">
        {% if SITELOGO %}
        <img src="{{ SITELOGO }}" alt="{{ SITETITLE }}" title="{{ SITETITLE }}">
        {% else %}
        <img src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/img/profile.png" alt="{{ SITETITLE }}" title="{{ SITETITLE }}">
        {% endif %}
      </a>

      <h1>
        <a href="{{ SITEURL }}">{{ SITETITLE }}</a>
      </h1>

      {% if SITESUBTITLE %}<p>{{ SITESUBTITLE }}</p>{% endif %}

      {% if PLUGINS and 'tipue_search' in PLUGINS %}
        <form class="navbar-search" action="/search.html" role="search">
          <input type="text" name="q" id="tipue_search_input" placeholder="{{ _('Search...') }}">
        </form>
      {% endif %}

      {% if pages or LINKS %}
      <nav>
        <ul class="list">
          {# Open links in new window depending on the LINKS_IN_NEW_TAB setting #}
          {% macro get_target(link) -%}
            {%- if LINKS_IN_NEW_TAB in ('all', true) -%}
            _blank
            {%- elif LINKS_IN_NEW_TAB == "external" and not link.startswith("/") and not link.startswith(SITEURL) -%}
            _blank
            {%- else -%}
            _self
            {%- endif -%}
          {%- endmacro %}

          {% if PAGES_SORT_ATTRIBUTE -%}
            {% set pages = pages|sort(attribute=PAGES_SORT_ATTRIBUTE) %}
          {%- endif %}

          {% if DISPLAY_PAGES_ON_MENU %}
            {% for page in pages %}
              <li>
                <a target="{{ get_target(SITEURL) }}"
                   href="{{ SITEURL }}/{{ page.url }}{% if not DISABLE_URL_HASH %}#{{ page.slug }}{% endif %}">
                  {{ page.title }}
                </a>
              </li>
            {% endfor %}
          {% endif %}

          {% for name, link in LINKS %}
            <li>
              <a target="{{ get_target(link) }}" href="{{ link }}" >{{ name }}</a>
            </li>
          {% endfor %}
        </ul>
      </nav>
      {% endif %}

      <ul class="social">
        {% for name, link in SOCIAL %}
          <li>
            <a {% if name == 'mastodon' %}rel="me"{% endif %} class="sc-{{ name }}" href="{{ link }}" target="_blank">
              <i class="{% if name in ['envelope', 'rss'] %}fas{% else %}fab{% endif %} fa-{{ name }}"></i>
            </a>
          </li>
        {% endfor %}
      </ul>
      <button class="theme-switch"><i class="fa fa-adjust fa-2x" aria-hidden="true" onclick="modeSwitcher()"></i></button>
    </div>

    {% if GOOGLE_ADSENSE and GOOGLE_ADSENSE.ads.aside %}
      <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
      <ins class="adsbygoogle ads-aside"
           data-ad-client="{{ GOOGLE_ADSENSE.ca_id }}"
           data-ad-slot="{{ GOOGLE_ADSENSE.ads.aside }}"></ins>
      <script>
        (adsbygoogle = window.adsbygoogle || []).push({});
      </script>
    {% endif %}
  </aside>
  <main>
    {% if GOOGLE_ADSENSE and GOOGLE_ADSENSE.ads.main_menu %}
      <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
      <ins class="adsbygoogle ads-responsive"
           data-ad-client="{{ GOOGLE_ADSENSE.ca_id }}"
           data-ad-slot="{{ GOOGLE_ADSENSE.ads.main_menu }}"></ins>
      <script>
        (adsbygoogle = window.adsbygoogle || []).push({});
      </script>
    {% endif %}

    {% if MAIN_MENU %}
    <nav>
      <a href="{{ SITEURL }}">{{ _('Home') }}</a>

      {% for title, link in MENUITEMS %}
      <a href="{{ link }}">{{ _(title) }}</a>
      {% endfor %}

      {% if FEED_ALL_ATOM %}
      <a href="{{ FEED_DOMAIN }}/{{ FEED_ALL_ATOM }}">{{ _('Atom') }}</a>
      {% endif %}

      {% if FEED_ALL_RSS %}
      <a href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}">{{ _('RSS') }}</a>
      {% endif %}
    </nav>
    {% endif %}

    {% block content %}
    {% endblock %}

    <footer>
      {% if CC_LICENSE %}
        {% include "partial/cc_license.html" %}
      {% else %}
        {% include "partial/copyright.html" %}
      {% endif %}
    </footer>
  </main>

  {% if GUAGES %}
    {% include "partial/guages.html" %}
  {% endif %}

  {% if ADD_THIS_ID %}
    <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid={{ ADD_THIS_ID }}" async="async"></script>
  {% endif %}

  {% if (PIWIK_URL and PIWIK_SITE_ID) or (MATOMO_URL and MATOMO_SITE_ID) %}
    {% include "partial/matomo.html" %}
  {% endif %}

  {% include "partial/jsonld.html" %}

  {% if GITHUB_CORNER_URL %}
    {% include 'partial/github.html' %}
  {% endif %}

  {% if PLUGINS and 'tipue_search' in PLUGINS %}
    <script>
      $(document).ready(function() {
        $('#tipue_search_input').tipuesearch();
      });
    </script>
  {% endif %}

  {% block additional_js %}{% endblock %}
</body>
</html>