dotfiles

My PC Dotfiles & Website

site/templates/macros/head.html (2376B)


 1{%- macro font(config) %}
 2<link
 3  rel="preload"
 4  href="{{ get_url(path='fonts/JetBrainsMono-Nerd-Regular.woff2') }}"
 5  as="font"
 6  type="font/woff2"
 7  crossorigin />
 8<link
 9  rel="stylesheet"
10  href="{{
11get_url(path='fonts.css', trailing_slash=false) }}" />
12{% endmacro font -%} {% macro styling(config) %}
13<link
14  rel="stylesheet"
15  href="{{
16get_url(path='style.css', trailing_slash=false) }}" />
17<script>
18  (() => {
19    const theme = document.cookie.match(/(?:^|;\s*)site_theme=([^;]*)/);
20    if (theme && {{ config.extra.color_schemes | json_encode | safe }}.includes(theme[1]))
21      document.documentElement.dataset.theme = theme[1];
22  })();
23</script>
24<link
25  rel="stylesheet"
26  href="{{ get_url(path='color.css', trailing_slash=false) }}" />
27{% endmacro styling %} {% macro feed_discovery(path) %}
28<link
29  rel="alternate"
30  type="application/rss+xml"
31  title="RSS"
32  href="{{ get_url(path=path, trailing_slash=false) }}" />
33{% endmacro feed_discovery %} {% macro favicon(config) %} {% if
34config.extra.favicon %}
35<link
36  rel="shortcut icon"
37  href="{{ get_url(path=config.extra.favicon, trailing_slash=false) }}"
38  type="image/x-icon" />
39{% endif %} {% endmacro favicon %} {% macro general_meta() %} {% set description
40= config.description %} {% set title = config.title %} {% if page %} {% set
41title = page.title %} {% if page.description %}{% set description =
42page.description %} {% else %}{% set description = page.content | striptags |
43truncate(length=160) %}{% endif %} {% elif section %} {% set title =
44section.title %} {% if section.description %}{% set description =
45section.description %}{% endif %} {% elif term %}{% set title = term.name %} {%
46elif taxonomy %}{% set title = taxonomy.name %}{% endif %}
47<meta name="description" content="{{ description }}" />
48<meta property="og:title" content="{{ title }}" />
49<meta property="og:description" content="{{ description }}" />
50<meta property="og:site_name" content="{{ config.title }}" />
51<meta
52  property="og:type"
53  content="{% if page and page.date %}article{% else %}website{% endif %}" />
54<meta name="twitter:card" content="summary" />
55{% if current_url %}
56<link rel="canonical" href="{{ current_url }}" />
57<meta property="og:url" content="{{ current_url }}" />
58{% else %}<meta name="robots" content="noindex" />{% endif %} {{
59head::feed_discovery(path=config.extra.feed_path) }} {% endmacro general_meta %}