all repos — blog @ 75adbc7c2aa0f2fee522891191458debbc6301a5

Code and content for 5ika.ch

Add activity on home pag
Tim Izzo tim@octree.ch
Wed, 10 Apr 2024 17:58:54 +0200
commit

75adbc7c2aa0f2fee522891191458debbc6301a5

parent

8ab3bf0a1ecdd159bb2d32567882d627a15152d0

M assets/css/style.cssassets/css/style.css

@@ -61,6 +61,17 @@ display: block;

padding-top: 0.5rem; padding-bottom: 0.5rem; } + + .activity-grid { + display: grid; + grid-template-columns: 1fr 4fr; + column-gap: 1rem; + row-gap: 1rem; + + > h4 { + margin: 0; + } + } @media only screen and (max-width: 600px) { main {

@@ -70,6 +81,10 @@

.links-list { display: grid; grid-template-columns: 1fr 1fr; + } + + .activity-grid { + grid-template-columns: 1fr; } }
M content/_index.mdcontent/_index.md

@@ -14,3 +14,5 @@ de [gestion des flux de déchets](./r-21) et d'[optimisation énergétique](./evospe)

de bâtiments. {{< links >}} + +{{< activity >}}
M layouts/index.htmllayouts/index.html

@@ -1,3 +1,3 @@

{{ define "main" }} <div>{{ .Content }}</div> -{{end}} +{{end}}
A layouts/shortcodes/activity.html

@@ -0,0 +1,21 @@

+<h3 style="margin-top:2rem">Activité récente</h3> +<div class="activity-grid"> + <h4>Dernière publication</h4> + <div> + {{ range first 1 (where site.RegularPages "Section" "posts") }} + <a href="{{ .RelPermalink }}">{{ .LinkTitle }} ({{ .Date | time.Format "Jan 2006" }})</a> + {{end}} + </div> + + <h4>Lecture en cours</h4> + <div> + {{ $outbox := getJSON "https://bookwyrm.social/user/5ika/outbox?page=1" }} + {{ with index $outbox.orderedItems 0 }} + <a href='{{ .id }}' target="_blank"> + {{ with index .attachment 0 }} + {{ .name }}</a> + {{ end }} + </a> + {{ end }} + </div> +</div>
M layouts/shortcodes/links.htmllayouts/shortcodes/links.html

@@ -1,8 +1,8 @@

-<div class="links-list"> +<nav class="links-list"> <a href="/posts">📝 Blog</a> <a href="./about">👋 Plus d’info</a> <a href="./now">⬇️ Maintenant</a> <a href="https://bookwyrm.social/user/5ika" target="_blank">📘 Lectures</a> <a href="https://tooting.ch/@5ika" target="_blank" rel="me">🐘 Mastodon</a> <a href="mailto:tim@5ika.ch" target="_blank">✉️ Email</a> -</div> +</nav>