mirror of
https://github.com/alanorth/hugo-theme-bootstrap4-blog.git
synced 2024-12-19 17:12:18 +01:00
Alan Orth
1655b876a8
Hugo 0.32 or so added the quasi-magical .Site.Params.mainSections slice that returns a range over the section that has the most number of pages. This way we don't need to hard code the "post" type, and instead simply use the pages that the user has created. Hugo's quickstart, for example, recommends users create "posts", which currently doesn't work with this theme! Closes #89
10 lines
388 B
HTML
10 lines
388 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.Pages "Section" "in" .Site.Params.mainSections) }}
|
|
<li><a href="{{.RelPermalink}}">{{.Title | markdownify }}</a></li>
|
|
{{ end }}
|
|
</ol>
|
|
</section>
|