summary refs log tree commit diff stats
path: root/src/themes/serene/templates/post.html
blob: 24fe0cdfb6595e678cfd7b8f8c58867d3cbda29c (plain) (blame)
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
{% import "macros/prose.html" as macros %}
{% extends "_base.html" %}

{% block page %}post{% endblock page %}
{% block lang -%}
{%- set blog_section_path = config.extra.blog_section_path | trim_start_matches(pat="/") -%}
{%- set section_md_path = blog_section_path ~ "/_index.md" -%}
{%- set section = get_section(path=section_md_path, metadata_only=true) -%}
{%- if page.extra.lang %}{{page.extra.lang}}{% elif section.extra.lang %}{{section.extra.lang}}{% else %}{{page.lang}}{% endif -%}
{%- endblock lang %}
{% block title %}{{ page.title }}{% endblock title %}
{% block desc %}
  {% if page.summary %}
    {% set desc = page.summary %}
  {% elif page.description %}
    {% set desc = page.description %}
  {% elif section.description %}
    {% set desc = section.description %}
  {% else %}
    {% set desc = config.description %}
  {% endif %}
  <meta name="description" content="{{ desc }}">
{% endblock desc %}

{% block head %}
{% if config.markdown.highlight_theme == "css" %}
<link id="hl" rel="stylesheet" type="text/css" href="/hl-{% if config.extra.force_theme == "dark" %}dark{% else %}light{% endif %}.css" />
{% endif %}
{% if page.extra.math %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/copy-tex.min.js" integrity="sha384-HORx6nWi8j5/mYA+y57/9/CZc5z8HnEw4WUZWy5yOn9ToKBv1l58vJaufFAn9Zzi" crossorigin="anonymous"></script>
<script>
    document.addEventListener("DOMContentLoaded", function () {
        renderMathInElement(document.body, {
            delimiters: [
                { left: '$$', right: '$$', display: true },
                { left: '$', right: '$', display: false },
                { left: '\\(', right: '\\)', display: false },
                { left: '\\[', right: '\\]', display: true }
            ],
            throwOnError: false
        });
    });
</script>
{% endif %}
{% endblock head %}

{% block content %}
<div id="wrapper">
  <div id="blank"></div>
  <aside>
    {% if page.extra.toc is defined %}{% set show_toc = page.extra.toc %}{% else %}{% set show_toc = section.extra.toc %}{% endif %}
    {% if show_toc and page.toc %}
    <nav>
      <ul>
        {% for h2 in page.toc %}
        <li>
          <a class="h2" href="#{{ h2.id | safe }}">{{ h2.title }}</a>
          {% if h2.children %}
          <ul>
            {% for h3 in h2.children %}
            <li>
              <a class="h3" href="#{{ h3.id | safe }}">{{ h3.title }}</a>
            </li>
            {% endfor %}
          </ul>
          {% endif %}
        </li>
        {% endfor %}
      </ul>
    </nav>
    {% endif %}
    {% if section.extra.back_to_top %}
    <button id="back-to-top" aria-label="back to top">
      {% set icon = load_data(path="icon/arrow-up.svg") %}
      {{ icon | safe }}
    </button>
    {% endif %}
  </aside>
  <main>
    {{ macros::back_link(path = get_url(path=section.path)) }}

    <div>
      {% if page.extra.copy is defined %}{% set allow_copy = page.extra.copy %}{% else %}{% set allow_copy = section.extra.copy %}{% endif %}
      {% if allow_copy %}
      {% set copy_icon = load_data(path="icon/copy.svg") %}
      {% set check_icon = load_data(path="icon/check.svg") %}
      <div id="copy-cfg" style="display: none;" data-copy-icon="{{ copy_icon }}" data-check-icon="{{ check_icon }}"></div>
      {% endif %}
      <article class="prose">
        <h1>{{ page.title }}</h1>
        <div id="post-info">
          <div id="date">
            <span id="publish">{{ page.date | date(format=section.extra.date_format) }}</span>
            {% if page.updated and page.updated != page.date -%}
            <span>Updated on <span id="updated">{{ page.updated | date(format=section.extra.date_format) }}</span></span>
            {% endif -%}
          </div>

          {% if page.taxonomies.tags is defined %}
          <div id="tags">
            {% for tag in page.taxonomies.tags -%}
            {% set tag_slugify = tag | slugify -%}
            <a class="instant" href="{{ config.base_url ~ '/tags/' ~ tag_slugify | safe }}"><span>#</span>{{ tag }}</a>
            {%- endfor %}
          </div>
          {% endif %}
        </div>

        {% if page.extra.outdate_alert is defined %}{% set show_outdate_alert = page.extra.outdate_alert %}{% else %}{% set show_outdate_alert = section.extra.outdate_alert %}{% endif %}
        {% if page.extra.outdate_alert_days is defined %}{% set outdate_alert_days = page.extra.outdate_alert_days %}{% else %}{% set outdate_alert_days = section.extra.outdate_alert_days %}{% endif %}

        {% if show_outdate_alert -%}
        <blockquote id="outdate_alert" class="callout caution hidden" data-days="{{ outdate_alert_days }}"
          data-alert-text-before="{{ section.extra.outdate_alert_text_before }}"
          data-alert-text-after="{{ section.extra.outdate_alert_text_after }}">
          <div class="content"></div>
        </blockquote>
        {% endif %}

        {{ page.content | safe }}
      </article>

      {% if page.extra.reaction is defined %}{% set show_reaction = page.extra.reaction %}{% else %}{% set show_reaction = config.extra.reaction %}{% endif %}
      {% if show_reaction %}
      <div class="reaction {{ config.extra.reaction_align }}" data-endpoint="{{ config.extra.reaction_endpoint }}"></div>
      {% endif %}

      {% if page.extra.comment is defined %}{% set show_comment = page.extra.comment %}{% else %}{% set show_comment = section.extra.comment %}{% endif %}
      {% if show_comment %}
      <div class="giscus"></div>
      {% include "_giscus_script.html" %}
      {% endif %}
    </div>

    {% include "_footer.html" %}
  </main>
</div>
{% endblock content %}

{% block script %}
<script src="/js/lightense.min.js"></script>
{% if page.extra.mermaid %}
<script type="module">
  import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
  mermaid.initialize({ startOnLoad: true });
</script>
{% endif %}
{% endblock script %}