mirror of
https://github.com/alanorth/hugo-theme-bootstrap4-blog.git
synced 2025-02-07 19:02:51 +01:00
This makes Hugo only list "Regular" pages in the sidebar. Otherwise if you have very few posts, for example, you might see one entry in the list called "Posts". See: https://gohugo.io/functions/where/#mainsections
10 lines
395 B
HTML
10 lines
395 B
HTML
<section class="sidebar-module">
|
|
<h4>{{ i18n "recentPosts" }}</h4>
|
|
<ol class="list-unstyled">
|
|
{{ $num_recent_posts := (index .Site.Params.sidebar "num_recent_posts" | default 5) }}
|
|
{{ range first $num_recent_posts (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
|
|
<li><a href="{{.RelPermalink}}">{{.Title | markdownify }}</a></li>
|
|
{{ end }}
|
|
</ol>
|
|
</section>
|