🔧 Add special list for archives articles show.
This commit is contained in:
parent
d42375820d
commit
af59e93d25
@ -1,29 +1,5 @@
|
||||
{{ range .Paginator.Pages.GroupByDate "2006" }}
|
||||
<div class="collection-year">
|
||||
<span class="collection-header">{{ .Key }}</span>
|
||||
</div>
|
||||
{{ range .Pages }}
|
||||
<article itemscope itemtype="http://schema.org/Article">
|
||||
<header class="post-header">
|
||||
<div class="post-meta-container">
|
||||
{{ $month := .Date.Format .Site.Params.monthFormat }}
|
||||
<time itemprop="dateCreated" datetime="{{ .Date.Format .Site.Params.timeFormat }}" content="{{ $month }}">
|
||||
{{ $month }}
|
||||
</time>
|
||||
</div>
|
||||
<div class="post-title">
|
||||
{{- if isset .Params "extlink" }}
|
||||
<a href="{{ .Params.extlink }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-title-link post-title-link-external" title="">
|
||||
<span itemprop="name">{{- .Title -}}</span>
|
||||
<i class="fa fa-external-link-alt"></i>
|
||||
</a>
|
||||
{{- if and .Page.IsSection (eq .Section "archives") }}
|
||||
{{ partial "list.html" ((.Paginator (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)).Pages.GroupByDate "2006") }}
|
||||
{{- else }}
|
||||
<a class="post-title-link" href="{{ .Permalink }}" itemprop="url">
|
||||
<span itemprop="name">{{ .Title }}</span>
|
||||
</a>
|
||||
{{ partial "list.html" (.Paginator.Pages.GroupByDate "2006") }}
|
||||
{{- end }}
|
||||
</div>
|
||||
</header>
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ end }}
|
@ -8,6 +8,9 @@
|
||||
<div class="collection-title">
|
||||
{{- $cheers := "Um" }}
|
||||
{{- $posts := .Scratch.Get "postsCount" }}
|
||||
{{- if and .Page.IsSection (ne .Section "archives") }}
|
||||
{{- $posts = .Scratch.Get .Section }}
|
||||
{{- end }}
|
||||
{{- if gt $posts 210 }}
|
||||
{{- $cheers = "Excellent" }}
|
||||
{{- else if gt $posts 130 }}
|
||||
|
@ -8,6 +8,9 @@
|
||||
{{ $globalVars := newScratch }}
|
||||
|
||||
{{ $globalVars.Set "postsCount" (len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)) }}
|
||||
{{ range .Site.Params.mainSections }}
|
||||
{{ $globalVars.Set . (len (where $.Page.Site.RegularPages "Section" .))}}
|
||||
{{ end }}
|
||||
{{ $globalVars.Set "catsCount" (len .Site.Taxonomies.categories) }}
|
||||
{{ $globalVars.Set "tagsCount" (len .Site.Taxonomies.tags) }}
|
||||
|
||||
|
29
layouts/partials/list.html
Normal file
29
layouts/partials/list.html
Normal file
@ -0,0 +1,29 @@
|
||||
{{ range . }}
|
||||
<div class="collection-year">
|
||||
<span class="collection-header">{{ .Key }}</span>
|
||||
</div>
|
||||
{{ range .Pages }}
|
||||
<article itemscope itemtype="http://schema.org/Article">
|
||||
<header class="post-header">
|
||||
<div class="post-meta-container">
|
||||
{{ $month := .Date.Format "01-02" }}
|
||||
<time itemprop="dateCreated" datetime="{{ .Date.Format "2006-01-02T15:04:05-07:00" }}" content="{{ $month }}">
|
||||
{{ $month }}
|
||||
</time>
|
||||
</div>
|
||||
<div class="post-title">
|
||||
{{- if isset .Params "extlink" }}
|
||||
<a href="{{ .Params.extlink }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-title-link post-title-link-external" title="">
|
||||
<span itemprop="name">{{- .Title -}}</span>
|
||||
<i class="fa fa-external-link-alt"></i>
|
||||
</a>
|
||||
{{- else }}
|
||||
<a class="post-title-link" href="{{ .Permalink }}" itemprop="url">
|
||||
<span itemprop="name">{{ .Title }}</span>
|
||||
</a>
|
||||
{{- end }}
|
||||
</div>
|
||||
</header>
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ end }}
|
Loading…
Reference in New Issue
Block a user