Skip to content

Commit 8dc0fd4

Browse files
committed
feat: Separate post entries from list items
1 parent e9e2c4d commit 8dc0fd4

File tree

2 files changed

+45
-28
lines changed

2 files changed

+45
-28
lines changed

layouts/_default/list.html

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,26 @@ <h1>{{ .Title | plainify }}</h1>
1818
{{- /* list content */}}
1919
<h2>See</h2>
2020

21-
{{- $paginator := .Paginate .Pages -}}
2221
{{- /* list items */}}
23-
<ul class="post-entries">
24-
{{- range $paginator.Pages }}
25-
<li>
26-
<div class="item">
22+
{{- if eq .Params.list_type "docs_list" }}
23+
{{- $paginator := .Paginate .Pages -}}
24+
<ul>
25+
{{- range $paginator.Pages }}
26+
<li>
2727
{{- /* list item */ -}}
2828
<a href="{{ .Permalink }}">
2929
{{- if .Title -}}
30-
<h2>
31-
{{- .Title | markdownify -}}
32-
</h2>
30+
{{- .Title | markdownify -}}
3331
{{- else -}}
3432
{{- .File.TranslationBaseName | markdownify -}}
3533
{{- end -}}
3634
</a>
37-
38-
{{- if and (not .IsSection) (or .Date .Params.Author) -}}
39-
<p class="post-meta">
40-
{{- with .Date -}}
41-
<span>{{ .Format "2006-01-02" -}}</span>
42-
{{- end -}}
43-
44-
{{- with .Params.Author -}}
45-
<span> | {{ . }}</span>
46-
{{- end -}}
47-
</p>
48-
{{- end -}}
49-
50-
{{- with .Params.Description -}}
51-
<p class="post-description">{{ . }}</p>
52-
{{- end -}}
53-
</div>
54-
</li>
55-
{{- end }}
56-
</ul>
35+
</li>
36+
{{- end -}}
37+
</ul>
38+
{{- else }}
39+
{{- partial "post-entries.html" . -}}
40+
{{- end }}
5741
</div>
5842

5943
<footer class="post-footer">

layouts/partials/post-entries.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{{- $paginator := .Paginate .Pages -}}
2+
<div class="post-entries">
3+
{{- range $paginator.Pages }}
4+
<div class="item">
5+
{{- /* list item */ -}}
6+
<a href="{{ .Permalink }}">
7+
{{- if .Title -}}
8+
<h2>
9+
{{- .Title | markdownify -}}
10+
</h2>
11+
{{- else -}}
12+
{{- .File.TranslationBaseName | markdownify -}}
13+
{{- end -}}
14+
</a>
15+
16+
{{- if and (not .IsSection) (or .Date .Params.Author) -}}
17+
<p class="post-meta">
18+
{{- with .Date -}}
19+
<span>{{ .Format "2006-01-02" -}}</span>
20+
{{- end -}}
21+
22+
{{- with .Params.Author -}}
23+
<span> | {{ . }}</span>
24+
{{- end -}}
25+
</p>
26+
{{- end -}}
27+
28+
{{- with .Params.Description -}}
29+
<p class="post-description">{{ . }}</p>
30+
{{- end -}}
31+
</div>
32+
{{- end }}
33+
</div>

0 commit comments

Comments
 (0)