summaryrefslogtreecommitdiff
path: root/themes/blowfish/layouts/_default/list.html
blob: 7cc923889b003e353e9d5f67387b62ee0233dc43 (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
{{ define "main" }}

{{ .Scratch.Set "scope" "list" }}
{{ if .Site.Params.list.showHero | default false }}
{{ $heroStyle := print "partials/hero/" .Site.Params.list.heroStyle ".html" }}
{{ if templates.Exists $heroStyle }}
{{ partial $heroStyle . }}
{{ else }}
{{ partial "partials/hero/basic.html" . }}
{{ end }}
{{- end -}}

{{ $toc := and (.Params.showTableOfContents | default (.Site.Params.list.showTableOfContents | default false)) (in
.TableOfContents "<ul") }} <header>
  {{ if .Params.showBreadcrumbs | default (.Site.Params.list.showBreadcrumbs | default false) }}
  {{ partial "breadcrumbs.html" . }}
  {{ end }}
  <h1 class="mt-5 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .Title }}</h1>
  <div class="mt-1 mb-2 text-base text-neutral-500 dark:text-neutral-400 print:hidden">
    {{ partial "article-meta/list.html" (dict "context" . "scope" "single") }}
  </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 }}
  </header>
  <section class="{{ if $toc -}}
      mt-12
    {{- else -}}
      mt-0
    {{- end }} prose flex max-w-full flex-col dark:prose-invert lg:flex-row">
    {{ if $toc }}
    <div class="order-first px-0 lg:order-last lg:max-w-xs ltr:lg:pl-8 rtl:lg:pr-8">
      <div class="toc ltr:pl-5 rtl:pr-5 lg:sticky {{ if hasPrefix .Site.Params.header.layout "fixed" -}}
      lg:top-[140px]{{ else }}lg:top-10{{ end }}">
        {{ partial "toc.html" . }}
      </div>
    </div>
    {{ end }}
    <div class="min-w-0 min-h-0 max-w-prose">
      {{ .Content }}
    </div>




  </section>
  {{ if gt .Pages 0 }}

    {{ $cardView := .Params.cardView | default (.Site.Params.list.cardView | default false) }}
    {{ $cardViewScreenWidth := .Params.cardViewScreenWidth | default (.Site.Params.list.cardViewScreenWidth | default false) }}
    {{ $groupByYear := .Params.groupByYear | default ($.Site.Params.list.groupByYear | default false) }}
    {{ $orderByWeight := .Params.orderByWeight | default ($.Site.Params.list.orderByWeight | default false) }}
    {{ $groupByYear := and (not $orderByWeight) $groupByYear }}

    {{ if not $cardView }}

    <section class="space-y-10 w-full">
      {{ if not $orderByWeight }}
        {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
        {{ if $groupByYear }}
        <h2 class="mt-12 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
          {{ .Key }}
        </h2>
        {{ end }}
        {{ range .Pages }}
        {{ partial "article-link/simple.html" . }}
        {{ end }}
        {{ end }}
      {{ else }}
        {{ range (.Paginate (.Pages.ByWeight)).Pages }}
        {{ partial "article-link/simple.html" . }}
        {{ end }}
      {{ end }}
    </section>

    {{ else }}

      {{ if $groupByYear }}

      {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
        {{ if $cardViewScreenWidth }}
        <div class="relative w-screen max-w-[1600px] px-[30px]" style="left: calc(max(-50vw,-800px) + 50%);">
        {{ end }}
          <h2 class="mt-12 mb-3 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
            {{ .Key }}
          </h2>
        <section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 {{ if $cardViewScreenWidth }} xl:grid-cols-4 2xl:grid-cols-5 {{ end }}">
          {{ range .Pages }}
          {{ partial "article-link/card.html" . }}
          {{ end }}
        </section>
        {{ if $cardViewScreenWidth }} </div> {{ end }}
      {{ end }}

      {{ else }}

        {{ if $cardViewScreenWidth }}
        <div class="relative w-screen max-w-[1600px] px-[30px]" style="left: calc(max(-50vw,-800px) + 50%);">
        <section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">
        {{ else }}
        <section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3">
        {{ end }}
        {{ if not $orderByWeight }}
          {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
          {{ range .Pages }}
          {{ partial "article-link/card.html" . }}
          {{ end }}
          {{ end }}
        {{ else }}
          {{ range (.Paginate (.Pages.ByWeight)).Pages }}
          {{ partial "article-link/card.html" . }}
          {{ end }}
        {{ end }}
        </section>
        {{ if $cardViewScreenWidth }} </div> {{ end }}

    {{ end }}

    {{end}}

  {{ else }}
  <section class="mt-10 prose dark:prose-invert">
    <p class="py-8 border-t">
      <em>{{ i18n "list.no_articles" | emojify }}</em>
    </p>
  </section>
  {{ end }}

    {{ partial "pagination.html" . }}

  {{ end }}