|
| 1 | +{# -*- coding: utf-8 -*- #} |
| 2 | + |
| 3 | +{% import 'annotation_helper.tmpl' as notes with context %} |
| 4 | +{% macro html_headstart() %} |
| 5 | +<!DOCTYPE html> |
| 6 | +<html |
| 7 | + |
| 8 | +{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) or (comment_system == 'facebook') %} |
| 9 | +prefix=' |
| 10 | +{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) %} |
| 11 | +og: http://ogp.me/ns# |
| 12 | +{% endif %} |
| 13 | +{% if use_open_graph %} |
| 14 | +article: http://ogp.me/ns/article# |
| 15 | +{% endif %} |
| 16 | +{% if comment_system == 'facebook' %} |
| 17 | +fb: http://ogp.me/ns/fb# |
| 18 | +{% endif %} |
| 19 | +' |
| 20 | +{% endif %} |
| 21 | + |
| 22 | +{% if is_rtl %} |
| 23 | +dir="rtl" |
| 24 | +{% endif %} |
| 25 | + |
| 26 | +lang="{{ lang }}"> |
| 27 | + <head> |
| 28 | + <meta charset="utf-8"> |
| 29 | + {% if use_base_tag %} |
| 30 | + <base href="{{ abs_link(permalink) }}"> |
| 31 | + {% endif %} |
| 32 | + {% if description %} |
| 33 | + <meta name="description" content="{{ description|e }}"> |
| 34 | + {% endif %} |
| 35 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 36 | + {% if title == blog_title %} |
| 37 | + <title>{{ blog_title|e }}</title> |
| 38 | + {% else %} |
| 39 | + <title>{{ title|e }} | {{ blog_title|e }}</title> |
| 40 | + {% endif %} |
| 41 | + |
| 42 | + {{ html_stylesheets() }} |
| 43 | + <meta name="theme-color" content="{{ theme_color }}"> |
| 44 | + {% if meta_generator_tag %} |
| 45 | + <meta name="generator" content="Nikola (getnikola.com)"> |
| 46 | + {% endif %} |
| 47 | + {{ html_feedlinks() }} |
| 48 | + <link rel="canonical" href="{{ abs_link(permalink) }}"> |
| 49 | + |
| 50 | + {% if favicons %} |
| 51 | + {% for name, file, size in favicons %} |
| 52 | + <link rel="{{ name }}" href="{{ file }}" sizes="{{ size }}"/> |
| 53 | + {% endfor %} |
| 54 | + {% endif %} |
| 55 | + |
| 56 | + {% if comment_system == 'facebook' %} |
| 57 | + <meta property="fb:app_id" content="{{ comment_system_id }}"> |
| 58 | + {% endif %} |
| 59 | + |
| 60 | + {% if prevlink %} |
| 61 | + <link rel="prev" href="{{ prevlink }}" type="text/html"> |
| 62 | + {% endif %} |
| 63 | + {% if nextlink %} |
| 64 | + <link rel="next" href="{{ nextlink }}" type="text/html"> |
| 65 | + {% endif %} |
| 66 | + |
| 67 | + {{ mathjax_config }} |
| 68 | + {% if use_cdn %} |
| 69 | + <!--[if lt IE 9]><script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]--> |
| 70 | + {% else %} |
| 71 | + <!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5.js', lang, url_type) }}"></script><![endif]--> |
| 72 | + {% endif %} |
| 73 | + |
| 74 | + {{ extra_head_data }} |
| 75 | +{% endmacro %} |
| 76 | + |
| 77 | +{% macro late_load_js() %} |
| 78 | + {% if use_bundles %} |
| 79 | + {% if use_cdn %} |
| 80 | + <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> |
| 81 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.13.0/umd/popper.min.js" integrity="sha256-pS96pU17yq+gVu4KBQJi38VpSuKN7otMrDQprzf/DWY=" crossorigin="anonymous"></script> |
| 82 | + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> |
| 83 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js" integrity="sha256-lQrWH6UPtNlJURtEYCgKDqLyBscHa/uF/nFle9bx3tI=" crossorigin="anonymous"></script> |
| 84 | + <script src="/assets/js/all.js"></script> |
| 85 | + {% else %} |
| 86 | + <script src="/assets/js/all-nocdn.js"></script> |
| 87 | + {% endif %} |
| 88 | + {% else %} |
| 89 | + {% if use_cdn %} |
| 90 | + <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> |
| 91 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.13.0/umd/popper.min.js" integrity="sha256-pS96pU17yq+gVu4KBQJi38VpSuKN7otMrDQprzf/DWY=" crossorigin="anonymous"></script> |
| 92 | + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> |
| 93 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js" integrity="sha256-lQrWH6UPtNlJURtEYCgKDqLyBscHa/uF/nFle9bx3tI=" crossorigin="anonymous"></script> |
| 94 | + {% else %} |
| 95 | + <script src="/assets/js/jquery.min.js"></script> |
| 96 | + <script src="/assets/js/popper.min.js"></script> |
| 97 | + <script src="/assets/js/bootstrap.min.js"></script> |
| 98 | + <script src="/assets/js/baguetteBox.min.js"></script> |
| 99 | + <script src="/assets/js/moment-with-locales.min.js"></script> |
| 100 | + <script src="/assets/js/fancydates.js"></script> |
| 101 | + {% endif %} |
| 102 | + {% endif %} |
| 103 | + {{ social_buttons_code }} |
| 104 | +{% endmacro %} |
| 105 | + |
| 106 | + |
| 107 | +{% macro html_stylesheets() %} |
| 108 | + {% if use_bundles %} |
| 109 | + {% if use_cdn %} |
| 110 | + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> |
| 111 | + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css" integrity="sha256-FqCzNnnyXl5HxHMdb+RQ/RV/X7fqfPcQYy+G2gFL3Xk=" crossorigin="anonymous" /> |
| 112 | + <link href="/assets/css/all.css" rel="stylesheet" type="text/css"> |
| 113 | + {% else %} |
| 114 | + <link href="/assets/css/all-nocdn.css" rel="stylesheet" type="text/css"> |
| 115 | + {% endif %} |
| 116 | + {% else %} |
| 117 | + {% if use_cdn %} |
| 118 | + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> |
| 119 | + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css" integrity="sha256-FqCzNnnyXl5HxHMdb+RQ/RV/X7fqfPcQYy+G2gFL3Xk=" crossorigin="anonymous" /> |
| 120 | + {% else %} |
| 121 | + <link href="/assets/css/bootstrap.min.css" rel="stylesheet" type="text/css"> |
| 122 | + <link href="/assets/css/baguetteBox.min.css" rel="stylesheet" type="text/css"> |
| 123 | + {% endif %} |
| 124 | + <link href="/assets/css/rst.css" rel="stylesheet" type="text/css"> |
| 125 | + <link href="/assets/css/code.css" rel="stylesheet" type="text/css"> |
| 126 | + <link href="/assets/css/theme.css" rel="stylesheet" type="text/css"> |
| 127 | + <link href="/assets/css/bootblog.css" rel="stylesheet" type="text/css"> |
| 128 | + {% if has_custom_css %} |
| 129 | + <link href="/assets/css/custom.css" rel="stylesheet" type="text/css"> |
| 130 | + {% endif %} |
| 131 | + {% endif %} |
| 132 | + {% if needs_ipython_css %} |
| 133 | + <link href="/assets/css/ipython.min.css" rel="stylesheet" type="text/css"> |
| 134 | + <link href="/assets/css/nikola_ipython.css" rel="stylesheet" type="text/css"> |
| 135 | + {% endif %} |
| 136 | + <link href="https://fonts.googleapis.com/css?family=Playfair+Display:700,900" rel="stylesheet"> |
| 137 | + {% if annotations and post and not post.meta('noannotations') %} |
| 138 | + {{ notes.css() }} |
| 139 | + {% elif not annotations and post and post.meta('annotations') %} |
| 140 | + {{ notes.css() }} |
| 141 | + {% endif %} |
| 142 | +{% endmacro %} |
| 143 | + |
| 144 | +{% macro html_navigation_links() %} |
| 145 | + {% for url, text in navigation_links[lang] %} |
| 146 | + {% if isinstance(url, tuple) %} |
| 147 | + <li class="nav-item dropdown"><a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{ text }}</a> |
| 148 | + <div class="dropdown-menu"> |
| 149 | + {% for suburl, text in url %} |
| 150 | + {% if rel_link(permalink, suburl) == "#" %} |
| 151 | + <a href="{{ permalink }}" class="dropdown-item active">{{ text }} <span class="sr-only">{{ messages("(active)", lang) }}</span></a> |
| 152 | + {% else %} |
| 153 | + <a href="{{ suburl }}" class="dropdown-item">{{ text }}</a> |
| 154 | + {% endif %} |
| 155 | + {% endfor %} |
| 156 | + </div> |
| 157 | + {% else %} |
| 158 | + {% if rel_link(permalink, url) == "#" %} |
| 159 | +{# <a class="p-2 text-white bg-secondary active" href="{{ url }}">{{ text }} <span class="sr-only">{{ messages("(active)", lang) }}</span></a> #} |
| 160 | + <li class="nav-item active"><a href="{{ permalink }}" class="nav-link">{{ text }} <span class="sr-only">{{ messages("(active)", lang) }}</span></a> |
| 161 | + {% else %} |
| 162 | + <li class="nav-item"><a href="{{ url }}" class="nav-link">{{ text }}</a> |
| 163 | + {% endif %} |
| 164 | + {% endif %} |
| 165 | + {% endfor %} |
| 166 | +{% endmacro %} |
| 167 | + |
| 168 | +{% macro html_feedlinks() %} |
| 169 | + {% if rss_link %} |
| 170 | + {{ rss_link }} |
| 171 | + {% elif generate_rss %} |
| 172 | + {% if translations|length > 1 %} |
| 173 | + {% for language in translations|sort %} |
| 174 | + <link rel="alternate" type="application/rss+xml" title="RSS ({{ language }})" href="{{ _link('rss', None, language) }}"> |
| 175 | + {% endfor %} |
| 176 | + {% else %} |
| 177 | + <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ _link('rss', None) }}"> |
| 178 | + {% endif %} |
| 179 | + {% endif %} |
| 180 | + {% if generate_atom %} |
| 181 | + {% if translations|length > 1 %} |
| 182 | + {% for language in translations|sort %} |
| 183 | + <link rel="alternate" type="application/atom+xml" title="Atom ({{ language }})" href="{{ _link('index_atom', None, language) }}"> |
| 184 | + {% endfor %} |
| 185 | + {% else %} |
| 186 | + <link rel="alternate" type="application/atom+xml" title="Atom" href="{{ _link('index_atom', None) }}"> |
| 187 | + {% endif %} |
| 188 | + {% endif %} |
| 189 | +{% endmacro %} |
| 190 | + |
| 191 | +{% macro html_translations() %} |
| 192 | + {% for langname in translations|sort %} |
| 193 | + {% if langname != lang %} |
| 194 | + <a href="{{ abs_link(_link("root", None, langname)) }}" rel="alternate" hreflang="{{ langname }}" class="p-2 text-secondary">{{ messages("LANGUAGE", langname) }}</a> |
| 195 | + {% endif %} |
| 196 | + {% endfor %} |
| 197 | +{% endmacro %} |
0 commit comments