|
3 | 3 | summary, "Read post" link). Reuses the .tx-news-* styles from the news list. |
4 | 4 |
|
5 | 5 | Params: |
6 | | - count — number of posts to show (default 1) |
| 6 | + count — number of posts to show (default 3) |
7 | 7 | 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. |
8 | 12 | */ -}} |
9 | | -{{- $count := .Get "count" | default "1" | int -}} |
| 13 | +{{- $count := .Get "count" | default "3" | int -}} |
10 | 14 | {{- $title := .Get "title" | default "Latest news" -}} |
11 | 15 | {{- $news := .Site.GetPage "/news" -}} |
12 | 16 | {{ with $news }} |
13 | 17 | <section class="tx-section"> |
14 | 18 | <div class="tx-container"> |
15 | 19 | <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> |
33 | 39 | </div> |
34 | 40 | </section> |
35 | 41 | {{ end }} |
0 commit comments