Welcome to mirror list, hosted at ThFree Co, Russian Federation.

list.html « _default « layouts - github.com/yihui/hugo-xmag.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 776d6770f5986463316381912688f02d78bfa4b4 (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
{{ partial "header.html" . }}

<div class="container">
<main class="list">
{{ $paginator := .Paginate (where .Data.Pages "Section" "!=" "") }}
{{ range $paginator.Pages }}
<section class="article-list">
  <div class="categories">
  {{ with .Params.categories }}
  {{ range first 1 . }}
    <a href="{{ relURL (print "/categories/" . | urlize) }}">{{ . }}</a>
  {{ end }}
  {{ else }}
    <a>{{ default "Uncategorized" .Site.Params.text.uncategorized }}</a>
  {{ end }}
  </div>
  <h1><a href="{{ .URL }}">{{ .Title }}</a></h1>
  <div class="date-author">
    {{ if .Params.author }}<span class="author">{{ partial "author_names.html" . }}</span> / {{ end }}
    <span class="date">{{ .Date.Format "2006-01-02" }}</span>
  </div>
  <div class="summary">
    <a href="{{ .URL }}">
    {{ with .Params.thumbnail }}
    <div class="thumbnail"><img src="{{ relURL . }}" alt="Thumbnail" /></div>
    {{ else }}
    {{ $img := findRE "<img src=\"[^\"]+\"" .Content 1 }}
    {{ range $img }}
    <div class="thumbnail">{{ (print . " alt=\"Thumbnail\" />") | safeHTML }}</div>
    {{ end }}
    {{ end }}
    {{ with .Description }}
    {{ $.Scratch.Set "summary" . }}
    {{ else }}
    {{ $.Scratch.Set "summary" (delimit (.Content | findRE "(<p.*?>(.|\n)*?</p>\\s*)+") "[&hellip;] ") }}
    {{ end }}
    {{ ($.Scratch.Get "summary") | plainify | truncate (default 200 .Site.Params.summary_length) (default " &hellip;" .Site.Params.text.truncated ) | replaceRE "&amp;" "&" | safeHTML }}
    </a>
  </div>
</section>
{{ end }}
</main>
<nav>{{ template "_internal/pagination.html" . }}</nav>
</div>

{{ partial "footer.html" . }}