Skip to content

Commit 9021bee

Browse files
committed
Add a full news page for everything in the feeds
This is linked to from the bottom of the truncated news sidebar
1 parent 9e40000 commit 9021bee

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

content/news.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: Codemeta News
3+
layout: single
4+
---
5+
6+
{{< news >}}

layouts/shortcodes/news.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<h2 class="ms-3">CodeMeta News</h2>
2+
<ul class="list-group list-unstyled">
3+
4+
{{ $items := slice }}
5+
6+
{{ range $feed := .Site.Data.feeds }}
7+
{{ $item := index $feed.channel "item" }}
8+
{{ $items = $items | append $item }}
9+
{{ end }}
10+
11+
{{ $combi := slice }}
12+
13+
{{- range $items -}}
14+
{{ $t := time.AsTime .pubDate }}
15+
{{ $m := dict "link" .link "title" .title "pubDate" $t "description" .description }}
16+
{{ $combi = $combi | append $m }}
17+
{{- end -}}
18+
19+
{{ $combi := sort $combi ".pubDate" "desc" }}
20+
21+
{{ range $combi }}
22+
<li class="ps-2 pb-2">
23+
<h3><a class="list-group-item newslink p-2" href="{{ .link }}">{{ .title }}</a></h3>
24+
<small class="ps-2 text-secondary-emphasis">{{ .pubDate | time.Format "Jan 02, 2006 3:04 PM MST" }}</small>
25+
<div class="ps-2 pt-2">{{ .description }}</div>
26+
</li>
27+
{{ end }}
28+
</ul>
29+
<div class="text-center "><small class="mw-100 text-secondary-emphasis">Updates daily</small></div>

0 commit comments

Comments
 (0)