nethunters.xyz/templates/macros/head.html

85 lines
3.3 KiB
HTML
Raw Normal View History

{#- TODO:
- [x] add rss
- [x] favicons
- [x] media preview
- [ ] twitter
- [ ] maybe google adsense
-#}
{% macro fonts() %}
<link rel="preload" href="{{ get_url(path="/assets/fonts/FiraCode-Regular.woff2") }}" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="{{ get_url(path="/assets/fonts/FiraCode-Bold.woff2") }}" as="font" type="font/woff2" crossorigin="anonymous">
{% endmacro fonts %}
{% macro styling() %}
<link rel="stylesheet" href="{{ get_url(path="style.css", cachebust=true) }}">
{% if config.extra.theme_color != "orange" -%}
{% set color = "color/" ~ config.extra.theme_color ~ ".css" -%}
<link rel="stylesheet" href="{{ get_url(path=color, cachebust=true) }}">
{%- else -%}
<link rel="stylesheet" href=" {{ get_url(path="color/orange.css", cachebust=true) }}">
{% endif %}
{%- if config.extra.custom_css is defined -%}
<link rel="stylesheet" href="{{ get_url(path="custom.css", cachebust=true) }}">
{% endif %}
{% endmacro styling %}
{% macro favicon() %}
{%- if config.extra.favicon is defined -%}
<link rel="shortcut icon" href="{{ get_url(path=config.extra.favicon) }}" type="image/x-icon" />
{%- endif -%}
{% endmacro favicon %}
{% macro rss() %}
{%- if config.generate_feed -%}
<link rel="alternate" type={% if config.feed_filename == "atom.xml" %}"application/atom+xml"{% else %}"application/rss+xml"{% endif %} title="{{ config.title }} RSS" href="{{ get_url(path=config.feed_filename) }}">
{%- endif -%}
{% endmacro rss %}
{% macro general_meta() %}
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
{%- if page.title -%}
<meta name="description" content="{{ config.description }} {{ page.title }} {{ page.description }}"/>
{%- else -%}
<meta name="description" content="{{ config.description }}"/>
{%- endif -%}
{%- if page.taxonomies.tags or page.taxonomies.categories -%}
<meta name="keywords" content="
{%- if page.taxonomies.categories -%}
{%- for cat in page.taxonomies.categories -%}
{{ cat }}, {% endfor -%}
{%- endif -%}
{%- if page.taxonomies.tags -%}
{%- for tag in page.taxonomies.tags -%}
{%- if loop.last -%}
{{ tag }}
{%- else -%}
{{ tag }}, {% endif -%}
{%- endfor -%}
{%- endif -%}
" />
{%- endif -%}
{% endmacro general_meta %}
{% macro katex() %}
{% if config.extra.enable_katex %}
<link rel="stylesheet" href="{{ get_url(path="assets/katex/katex.min.css") }}">
<script defer type="text/javascript" src="{{ get_url(path="assets/katex/katex.min.js") | safe }}"></script>
<script defer type="text/javascript" src="{{ get_url(path="assets/katex/mathtex-script-type.min.js") | safe }}"></script>
<script defer src="{{ get_url(path="assets/katex/auto-render.min.js") | safe }}"
onload="renderMathInElement(document.body, {
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true}
]
});"></script>
{% endif %}
{% endmacro katek %}