~bfiedler/website

ref: c8f900660125b75c4da75f544d4e43ef76b19ea5 website/layouts/blog/single.html -rw-r--r-- 1.9 KiB
c8f90066 — Ben Fiedler Fix highlighting in math posts 6 months ago
                                                                                
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
{{ define "main" }}
{{ partial "header.html" (dict "context" .  "IsDetailed" false) }}
<main class="blogpost">
    <article>
        <header>
            <h1 class="post-title">{{ .Title }}</h1>
            <span class="post-metadata">
                <time class="post-time" datetime="{{ .Date.Format "2006-01-02T15:04:05Z0700" }}">{{ .Date.Format "2006-01-02" }}</time>
                on <a href="/blog/">this blog</a>
                {{ partial "feed-icon.html" }}
            </span>
        </header>
        {{ $content := .Content }}
        {{- if in .Params.tags "math" }}
        {{ $content = replace $content "$" "<span class=\"inline-math\">$</span>" }}
        {{- end }}
        {{- if .Params.tags }}
        {{ $footnotes_tag := `<section class="footnotes" role="doc-endnotes">` }}
        {{- if strings.Contains $content $footnotes_tag }}
        {{ $split := split $content $footnotes_tag }}
        <section>{{ index $split 0 | safeHTML }}</section>
        <footer>
            <section class="post-metadata">
            tags: [
            <ul class="post-tags">
                {{- range .Params.tags }}
                <li>
                    <a href="/tags/{{ . }}">{{ . }}</a>
                </li>
                {{- end }}
            </ul>
            ]
            </section>
            {{ $footnotes_tag | safeHTML }}{{ index $split 1 | safeHTML }}
        </footer>
        {{- else }}
        <section>{{ $content }}</section>
        <footer class="post-metadata">
            tags: [
            <ul class="post-tags">
                {{- range .Params.tags }}
                <li>
                    <a href="/tags/{{ . }}">{{ . }}</a>
                </li>
                {{- end }}
            </ul>
            ]
        </footer>
        {{- end -}}
        {{- else }}
        <section>{{ $content }}</section>
        {{- end }}
    </article>
</main>
{{ partial "openring.html" . }}
{{ partial "footer.html" . }}
{{ end }}