Skip to content

Commit b27add6

Browse files
committed
theme(latest-news): default to 3 posts in single-column grid
1 parent 3b93a8b commit b27add6

1 file changed

Lines changed: 25 additions & 19 deletions

File tree

themes/terratheme/layouts/shortcodes/latest-news.html

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,39 @@
33
summary, "Read post" link). Reuses the .tx-news-* styles from the news list.
44

55
Params:
6-
count — number of posts to show (default 1)
6+
count — number of posts to show (default 3)
77
title — section heading (default "Latest news")
8+
9+
The list is wrapped in .tx-code-compare so it occupies a single column of
10+
the same two-column grid used by the side-by-side code panels — full width
11+
on mobile, half width at ≥720px.
812
*/ -}}
9-
{{- $count := .Get "count" | default "1" | int -}}
13+
{{- $count := .Get "count" | default "3" | int -}}
1014
{{- $title := .Get "title" | default "Latest news" -}}
1115
{{- $news := .Site.GetPage "/news" -}}
1216
{{ with $news }}
1317
<section class="tx-section">
1418
<div class="tx-container">
1519
<h2>{{ $title }}</h2>
16-
<ul class="tx-news-list">
17-
{{ range first $count .Pages.ByDate.Reverse }}
18-
<li class="tx-news-item">
19-
<a href="{{ .RelPermalink }}">
20-
<div class="tx-news-item-meta">
21-
<span class="tx-news-item-date">{{ .Date.Format "2006-01-02" }}</span>
22-
{{ if .ReadingTime }}<span>· {{ .ReadingTime }} min read</span>{{ end }}
23-
</div>
24-
<div class="tx-news-item-title">{{ .Title }}</div>
25-
{{ with .Description | default .Summary }}
26-
<p class="tx-news-item-summary">{{ . | safeHTML }}</p>
27-
{{ end }}
28-
<span class="tx-news-item-readmore">Read post →</span>
29-
</a>
30-
</li>
31-
{{ end }}
32-
</ul>
20+
<div class="tx-code-compare">
21+
<ul class="tx-news-list">
22+
{{ range first $count .Pages.ByDate.Reverse }}
23+
<li class="tx-news-item">
24+
<a href="{{ .RelPermalink }}">
25+
<div class="tx-news-item-meta">
26+
<span class="tx-news-item-date">{{ .Date.Format "2006-01-02" }}</span>
27+
{{ if .ReadingTime }}<span>· {{ .ReadingTime }} min read</span>{{ end }}
28+
</div>
29+
<div class="tx-news-item-title">{{ .Title }}</div>
30+
{{ with .Description | default .Summary }}
31+
<p class="tx-news-item-summary">{{ . | safeHTML }}</p>
32+
{{ end }}
33+
<span class="tx-news-item-readmore">Read post →</span>
34+
</a>
35+
</li>
36+
{{ end }}
37+
</ul>
38+
</div>
3339
</div>
3440
</section>
3541
{{ end }}

0 commit comments

Comments
 (0)