1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-12-25 03:34:29 +01:00

layouts: Allow specifying number of "Recent Posts" to display in the sidebar

Set the following param in your config:

  [params.sidebar]
    num_recent_posts = 5

Alternatively, delete or comment out the variable to disable showing
of recents. I should probably allow setting it to "0" to disable.
This commit is contained in:
Alan Orth 2016-08-28 22:44:18 +03:00
parent 72d8ffd7e3
commit 6ccdf9a438
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -3,6 +3,18 @@
<h4>About</h4>
<p>Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.</p>
</div>
{{ if isset .Site.Params.sidebar "num_recent_posts" }}
<div class="sidebar-module">
<h4>Recent Posts</h4>
<ol class="list-unstyled">
{{ range first .Site.Params.sidebar.num_recent_posts .Site.Pages }}
<li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
{{ end }}
</ol>
</div>
{{ end }}
<div class="sidebar-module">
<h4>Archives</h4>
<ol class="list-unstyled">