aboutsummaryrefslogtreecommitdiff
path: root/templates/base.html
diff options
context:
space:
mode:
authorJieiku2022-05-30 23:20:43 -0700
committerJieiku2022-05-30 23:20:43 -0700
commit30ea88e8d8c201c3fcce409a54712de820610dff (patch)
treeccf9c2ea31816153f59c725d85ba8eaa54e3ef21 /templates/base.html
parentd8cd3b9988f9021ea1b285db3231048acb7b74f4 (diff)
downloadabridge-30ea88e8d8c201c3fcce409a54712de820610dff.tar.gz
abridge-30ea88e8d8c201c3fcce409a54712de820610dff.tar.bz2
abridge-30ea88e8d8c201c3fcce409a54712de820610dff.zip
Add Favicons, Add Head Macro, 404 noindex, config.toml Resources, Whitespace Cleanup
Diffstat (limited to 'templates/base.html')
-rw-r--r--templates/base.html234
1 files changed, 58 insertions, 176 deletions
diff --git a/templates/base.html b/templates/base.html
index e811e33..237bf41 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -1,158 +1,32 @@
-{% import "macros/social.html" as social_macros %}
+{%- import 'macros/head.html' as macros_head %}
+{%- import "macros/social.html" as social_macros %}
+{%- import "macros/page.html" as page_macros %}
+{%- import "macros/macros.html" as macros %}
<!DOCTYPE html>
-<html lang="en">
+<html lang="{{ config.extra.language_code | default(value="en-US") }}">
<head>
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
<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 %}
+ {{- macros_head::resource() }}
+ {{- macros_head::stylesheet() }}
+ {%- block seo %}
+ {%- if config.extra.title_separator %}
+ {%- set title_separator = " " ~ config.extra.title_separator ~ " " -%}
+ {%- else %}
+ {%- set title_separator = " | " -%}
+ {%- endif %}
+ {%- endblock seo %}
+ {{- macros_head::favicons() }}
<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.extra.fonts_load %}
- {% for i in config.extra.fonts %}
- {% if 'http' in i.url %}
- <link rel="preload" href="{{ i.url | safe }}" as="style">
- {% else %}
- <link rel="preload" href="{{ get_url(path=i.url, trailing_slash=false, cachebust=true) }}" as="style">
- {% endif %}
- {% endfor %}
- {% endif %}
-
- {% if config.build_search_index %}
- <script defer type="text/javascript" src="{{ get_url(path="search_index.en.js", trailing_slash=false, cachebust=true) | safe }}"></script>
- <script defer type="text/javascript" src="{{ get_url(path="search.min.js", trailing_slash=false, cachebust=true) | safe }}"></script>
- {% endif %}
-
- {% if config.extra.katex_enabled %}
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js" integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx" crossorigin="anonymous"></script>
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script>
- {% if config.extra.katex_auto_render %}
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"></script>
- {% endif %}
- {% endif %}
-{% block extra_head %}{% endblock extra_head %}
+ {{- macros_head::math() }}
</head>
<body>
-{% block header %}
+{%- block header %}
<header>
<nav>
<header>
@@ -160,49 +34,57 @@
</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 %}
+ {%- 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 %}
+ {%- 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 %}
+ {%- 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 %}
+{%- endblock header %}
+ <main>
+ {%- block content %}
+ {%- endblock content %}
+ </main>
+{%- block footer %}
<footer>
<hr>
<center>
- <p>{{ social_macros::social_links(social_config=config.extra.social) }}</p>
+ <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>
+ {#- Copyright START #}
+ {%- 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>
+ {#- Copyright END #}
+ <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>
- <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 %}
+ {%- 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 %}
+{%- endblock footer %}
</body>
</html>