summaryrefslogtreecommitdiff
path: root/templates/page.html
blob: f795876d7c60ad7e1eade3543f1a5ca2698f3220 (plain)
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
{% extends "base.html" %}

{% import "macros.html" as macros %}

{% block content %}
<article class="post">
    <div class="post-title">
        <h1 class="title">{{ page.title }}</h1>
    </div>
    <div class="post-content">
        {{ page.content | safe }}
    </div>
    {{ macros::post_meta(post=page, chinese_date=config.extra.seje_chinese_date, expand=true) }}
</article>

<div class="prev_next">
<nav id="prev_next">
    <div class="prev">
        {% if page.later %}
        <p>{{ trans(key="newer") }}<</p><a href="{{ page.later.permalink }}"><div class="article-nav-title">{{ page.later.title }}</div></a>
        {% endif %}
    </div>
    <div class="next">
        {% if page.earlier %}
        <p>{{ trans(key="older") }}</p><a href="{{ page.earlier.permalink }}"><div class="article-nav-title">{{ page.earlier.title }}</div></a>
        {% endif %}
    </div>
</nav>
</div>

<div class="post-comment">
{# Discussion #}
{% block comment %}
{% if config.seje_disqus_shortname %}
<section id="comments">
    <div id="disqus_thread"></div>
    <script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = "{{ config.seje_disqus_shortname }}"; // required: replace example with your forum shortname
        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function () {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered
            by Disqus.</a></noscript>
</section>
{% endif %}
{% endblock %}
</div>

{% if page.extra.enable_img_caption %}
<script>
    const images = document.querySelectorAll(".post-content img");
    images.forEach((img) => {
        if (img.alt && img.alt.trim() !== "") {
            const caption = document.createElement("div");
            caption.className = "img-caption";
            caption.textContent = img.alt;

            let insertionPoint = img;
            if (img.parentElement.tagName === "A") {
                insertionPoint = img.parentElement;
            }

            insertionPoint.parentNode.insertBefore(
                caption,
                insertionPoint.nextSibling,
            );
        }
    });
</script>
{% endif %}

{% endblock %}