Skip to content

Commit e543040

Browse files
committed
Show some posts on homepage, rework layout of lists
1 parent 0c9d65b commit e543040

5 files changed

Lines changed: 31 additions & 15 deletions

File tree

assets/style.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ body {
2929
min-height: 100svh;
3030
}
3131

32+
sup {
33+
text-underline-offset: 0;
34+
}
35+
3236
header,
3337
main,
3438
footer {
3539
margin: 1em auto;
36-
max-width: 55ch;
40+
max-width: 65ch;
3741
}
3842

3943
header {

content/_index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ source projects, especially contributing to [Neovim](https://neovim.io).
1313
More ways to contact me can be found on the [contact](/contact/ "Contact page") page.
1414

1515
## Blog
16-
I occasionally post something on my [blog](/posts/ "My Blog").
16+
I occasionally post something on my blog. Here are the 5 latest posts:
17+
18+
{{< section-list "posts" 5 >}}
19+
20+
See the [full list here](/posts/).
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{ $section := .section }}
2+
{{ $limit := .limit | default 0 }}
3+
4+
{{ $pages := where site.RegularPages "Section" $section }}
5+
6+
{{ if gt $limit 0 }}
7+
{{ $pages = first $limit $pages }}
8+
{{ end }}
9+
<ul>
10+
{{ range $pages }}
11+
{{ if not .Params.Unlisted }}
12+
<li style="line-height: 2">
13+
<a href='{{ .RelPermalink }}'>
14+
{{ .Title | markdownify }} (<time datetime="{{ time.Format "2006-01-02" .Date }}">{{ time.Format "2006-01-02" .Date }}</time>)
15+
</a>
16+
</li>
17+
{{ end }}
18+
{{ end }}
19+
</ul>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ partial "section-list.html" (dict "section" (.Get 0) "limit" (.Get 1)) }}

layouts/list.html

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
{{ define "content" }}
22
<h2>{{ title .Section }}</h2>
3-
43
{{ .Content }}
5-
6-
<ul>
7-
{{ range (where site.RegularPages "Section" .Section) }}
8-
{{ if not .Params.Unlisted }}
9-
<li style="line-height: 2">
10-
<a href='{{ .RelPermalink }}'>
11-
{{ .Title | markdownify }} (<time datetime="{{ time.Format "2006-01-02" .Date }}">{{ time.Format "2006-01-02" .Date }}</time>)
12-
</a>
13-
</li>
14-
{{ end }}
15-
{{ end }}
16-
</ul>
4+
{{ partial "section-list.html" (dict "section" .Section) }}
175
{{ end }}

0 commit comments

Comments
 (0)