single.html 3.45 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
<article class="post h-entry {{ .Section }}">
8
    <header>
Kaushal Modi's avatar
Kaushal Modi committed
9 10 11 12
        {{ if .Params.draft }}
            <div class="draft right">Draft</div>
            <div class="clear-float"></div>
        {{ end }}
13 14
        <div class="center">{{ partial "taxo-buttons.html" . }}</div>

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

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

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

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

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

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

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

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

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

55 56 57 58 59 60 61 62 63
{{ 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>
64
            {{ printf `<span class="small-caps">Versions used</span>:` | safeHTML }}
65
            {{ range $k, $v := . }}
Kaushal Modi's avatar
Kaushal Modi committed
66 67
                {{ printf "<code>%s</code> " $k | safeHTML }}
                {{ if (eq "string" (printf "%T" $v)) }} <!-- Check if the value is a string -->
68 69 70 71 72 73
                    {{ $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
74 75 76 77 78
                {{- 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")) "" ", " }}
79 80 81
            {{ end }}
        </small>
    </div>
Kaushal Modi's avatar
Kaushal Modi committed
82 83
{{ end }}

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

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

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

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

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

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

{{ end }}