single.html 3.42 KB
Newer Older
Kaushal Modi's avatar
Kaushal Modi committed
1 2
{{ define "main" }}

3
<!-- http://microformats.org/wiki/h-entry -->
Kaushal Modi's avatar
Kaushal Modi committed
4 5 6
<!-- h-entry validation: https://xray.p3k.io/ -->
<!-- authorship testing: https://sturdy-backbone.glitch.me/ -->

7 8 9 10 11
{{ if .Params.draft }}
    <div class="draft right">Draft</div>
    <div class="clear-float"></div>
{{ end }}

12
<article class="post h-entry {{ .Section }}">
13
    <header>
14 15
        <div class="center">{{ partial "taxo-buttons.html" . }}</div>

16
        <h1 class="post-title p-name">{{ .Title }}</h1>
17

18
        <!-- To complete the h-entry meta-data as per https://indiewebify.me/validate-h-entry/ -->
19
        <data class="u-url" value="{{ .Permalink }}"></data>
20

21
        <div class="date-syndication">
22
            {{ partial "date-maybe.html" (dict "page" . "fmt" (.Param "dateform")) }}
23 24
            {{ partial "syndication.html" . }}
        </div>
25

26 27
        {{ if not .Params.notoc }}
            {{ with .TableOfContents }}
28
                <div class="hugotoc no-text-decoration">
29 30 31 32
                    {{ . }}
                    <a href="#top" class="back-to-top">Back to top</a>
                </div>
            {{ end }}
33
            {{ partialCached "toc_on_side.html" . }}
34
        {{ end }}
35
    </header>
36

37 38 39 40 41 42
    <div class="content">
        {{ with .Description }}
            <div class="description p-summary">
                {{ . | markdownify }}
            </div>
        {{ end }}
43

44
        {{ partial "series.html" . }}
45

46
        {{ partial "author.html" . }}
Kaushal Modi's avatar
Kaushal Modi committed
47

48 49
        <div class="e-content">
            {{ partial "headline-hash.html" .Content }}
50
        </div>
51
    </div>
52 53 54
</article>

{{ end }}
Kaushal Modi's avatar
Kaushal Modi committed
55

56 57 58 59 60 61 62 63 64
{{ define "footer" }}

<!-- Print versions at the end of the post, if specified. -->
{{ with .Params.versions }}
    {{ $.Scratch.Set "__versions_len" (len .) }}
    {{ $.Scratch.Set "__versions_cnt" 0 }}
    <hr />
    <div>
        <small>
65
            {{ printf `<span class="small-caps">Versions used</span>:` | safeHTML }}
66
            {{ range $k, $v := . }}
Kaushal Modi's avatar
Kaushal Modi committed
67 68
                {{ printf "<code>%s</code> " $k | safeHTML }}
                {{ if (eq "string" (printf "%T" $v)) }} <!-- Check if the value is a string -->
69 70 71 72 73 74
                    {{ $v_is_hex := findRE "^[0-9a-f]{6,}$" ($v | lower) }}
                    {{ if (and (eq "nim" ($k | lower)) $v_is_hex) }}
                        {{ printf `<a href="https://github.com/nim-lang/Nim/commit/%s">%s</a>` $v $v | safeHTML -}}
                    {{ else }}
                        {{ printf "%s" $v | safeHTML -}} <!-- Don't print strings using "%#v" else they get double-quoted -->
                    {{ end }}
Kaushal Modi's avatar
Kaushal Modi committed
75 76 77 78 79
                {{- else -}}
                    {{- printf "%#v" $v | safeHTML -}} <!-- Cannot print floats like 0.39 using "%s", so using "%#v" -->
                {{- end -}}
                {{- $.Scratch.Add "__versions_cnt" 1 -}}
                {{- cond (eq ($.Scratch.Get "__versions_cnt") ($.Scratch.Get "__versions_len")) "" ", " }}
80 81 82
            {{ end }}
        </small>
    </div>
Kaushal Modi's avatar
Kaushal Modi committed
83 84
{{ end }}

85 86
{{ partial "jump.html" }}

87 88 89 90 91
<!-- Back to top -->
<div class="backtotop center no-text-decoration">
    <a href="#top">back to <span class="top">top</span></a>
</div>

92
<!-- Tags/categories -->
93 94
<div class="right">{{ partial "taxo-buttons.html" . }}</div>
<div class="clear-float"></div>
Kaushal Modi's avatar
Kaushal Modi committed
95

96
<!-- Prev/next post -->
97
{{ partial "prev_next.html" . }}
Kaushal Modi's avatar
Kaushal Modi committed
98

99
<a id="bottom"></a>
100
<!-- Send/receive Webmentions -->
Kaushal Modi's avatar
Kaushal Modi committed
101
{{ partial "webmention_send.html" . }}
Kaushal Modi's avatar
Kaushal Modi committed
102
{{ partial "webmention_rcv.html" . }}
103 104 105

<!-- Other Comments -->
{{ partial "comments.html" . }}
Kaushal Modi's avatar
Kaushal Modi committed
106 107

{{ end }}