summaryrefslogtreecommitdiff
path: root/themes/blowfish/layouts/_default/single.html
blob: c0de7c41dff839b7ba54ebee9139b6e9dac83887 (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
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
152
153
154
155
156
157
158
159
160
161
{{ define "main" }}
{{ .Scratch.Set "scope" "single" }}

<article>
  {{ if .Params.showHero | default (.Site.Params.article.showHero | default false) }}
  {{ $heroStyle := .Params.heroStyle }}
  {{ if not $heroStyle }}{{ $heroStyle = .Site.Params.article.heroStyle }}{{ end }}
  {{ $heroStyle := print "partials/hero/" $heroStyle ".html" }}
  {{ if templates.Exists $heroStyle }}
  {{ partial $heroStyle . }}
  {{ else }}
  {{ partial "partials/hero/basic.html" . }}
  {{ end }}
  {{ end }}

  <header id="single_header" class="mt-5 max-w-prose">
    {{ if .Params.showBreadcrumbs | default (.Site.Params.article.showBreadcrumbs | default false) }}
    {{ partial "breadcrumbs.html" . }}
    {{ end }}
    <h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">
      {{ .Title | emojify }}
    </h1>
    <div class="mt-1 mb-6 text-base text-neutral-500 dark:text-neutral-400 print:hidden">
      {{ partial "article-meta/basic.html" (dict "context" . "scope" "single") }}
    </div>

    {{ $authorsData := .Site.Data.authors }}
    {{ $taxonomies := .Site.Taxonomies.authors }}
    {{ $baseURL := .Site.BaseURL }}
    {{ $taxonomyLink := 0 }}
    {{ $showAuthor := 0 }}

    {{ if not (strings.HasSuffix $baseURL "/") }}
    {{ $baseURL = delimit (slice $baseURL "/") "" }}
    {{ end }}

    {{ if not (.Params.showAuthorBottom | default ( .Site.Params.article.showAuthorBottom | default false)) }}
      
      {{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }}
        {{ $showAuthor = 1 }}
        {{ partial "author.html" . }}
      {{ end }}

      {{ range $author := .Page.Params.authors }}
        {{ $authorData := index $authorsData $author }}
        {{- if $authorData -}}
          {{ range $taxonomyname, $taxonomy := $taxonomies }}
            {{ if (eq $taxonomyname $author) }}
              {{ $taxonomyLink = delimit (slice $baseURL "authors/" $author "/") "" }}
            {{ end }}
          {{ end }}
          {{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $taxonomyLink) }}
        {{- end -}}
      {{ end }}

      {{ if or $taxonomyLink $showAuthor }}
      <div class="mb-5"></div>
      {{ end }}

    {{ end }}

  </header>
  
  <section class="flex flex-col max-w-full mt-0 prose dark:prose-invert lg:flex-row">
    
    {{ if or (and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in
    .TableOfContents "<ul")) (.Site.Params.article.showRelatedPosts | default false) }} <div
      class="order-first lg:ml-auto px-0 lg:order-last ltr:lg:pl-8 rtl:lg:pr-8">
      <div class="toc ltr:pl-5 rtl:pr-5 print:hidden lg:sticky {{ if hasPrefix .Site.Params.header.layout "fixed" -}}
        lg:top-[140px]{{ else }}lg:top-10{{ end }}">

        {{ if and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in
        .TableOfContents "<ul") }} {{ partial "toc.html" . }} {{ end }} {{ if .Site.Params.article.showRelatedPosts |
          default false }} sd {{ end }} </div>
      </div>
      {{ end }}

      <div class="min-w-0 min-h-0 max-w-fit">
        
        {{ partial "series/series.html" . }}

        <div class="article-content max-w-prose mb-20">
          {{ .Content }}
          {{ $defaultReplyByEmail := .Site.Params.replyByEmail }}
          {{ $replyByEmail := default $defaultReplyByEmail .Params.replyByEmail }}
          {{ if $replyByEmail }}
            <strong class="block mt-8">
              <a target="_blank" 
              class="m-1 rounded bg-neutral-300 p-1.5 text-neutral-700 hover:bg-primary-500 hover:text-neutral dark:bg-neutral-700 dark:text-neutral-300 dark:hover:bg-primary-400 dark:hover:text-neutral-800"
              href="mailto:{{ .Site.Params.Author.email }}?subject={{ replace (printf "Reply to %s" .Title) "\"" "'" }}">
                Reply by Email
              </a>
            </strong>
          {{ end }}
        </div>
        
        {{ if (.Params.showAuthorBottom | default ( .Site.Params.article.showAuthorBottom | default false)) }}

          {{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }}
            {{ $showAuthor = 1 }}
            {{ partial "author.html" . }}
          {{ end }}

          {{ range $author := .Page.Params.authors }}
            {{ $authorData := index $authorsData $author }}
            {{- if $authorData -}}
              {{ range $taxonomyname, $taxonomy := $taxonomies }}
                {{ if (eq $taxonomyname $author) }}
                  {{ $taxonomyLink = delimit (slice $baseURL "authors/" $author "/") "" }}
                {{ end }}
              {{ end }}
              {{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $taxonomyLink) }}
            {{- end -}}
          {{ end }}

          {{ if or $taxonomyLink $showAuthor }}
          <div class="mb-10"></div>
          {{ end }}

        {{ end }}

        {{ partial "series/series-closed.html" . }}
        {{ partial "sharing-links.html" . }}
        {{ partial "related.html" . }}  
      </div>
     
      {{ $translations := .AllTranslations }}
      {{ with .File }}
        {{ $path := .Path }}
        {{range $translations}}
          {{ $lang := print "."  .Lang  ".md" }}
          {{ $path = replace $path $lang ".md" }}
        {{end}}
      <script>
        var oid = "views_{{ $path }}"
        var oid_likes = "likes_{{ $path }}"
      </script>
      {{ $jsPage := resources.Get "js/page.js" }}
      {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
      <script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script>
      {{ end }}
  
    </section>
  <footer class="pt-8 max-w-prose print:hidden">

    {{ partial "article-pagination.html" . }}
    {{ if .Params.showComments | default (.Site.Params.article.showComments | default false) }}
    {{ if templates.Exists "partials/comments.html" }}
    <div class="pt-3">
      <hr class="border-dotted border-neutral-300 dark:border-neutral-600" />
      <div class="pt-3">
        {{ partial "comments.html" . }}
      </div>
    </div>
    {{ else }}
    {{ warnf "[BLOWFISH] Comments are enabled for %s but no comments partial exists." .File.Path }}
    {{ end }}
    {{ end }}
  </footer>
</article>
{{ end }}