mirror of
https://github.com/alanorth/hugo-theme-bootstrap4-blog.git
synced 2024-11-16 01:07:03 +01:00
layouts/partials/sidebar.html: Check before using sidebar params
If the user's config doesn't have [params.sidebar] defined they get errors when trying to build the site. It's better if we just check that this config block is defined before trying to use it, and then add something to the docs telling people that the site looks really bad without this defined.
This commit is contained in:
parent
bcbc28b32b
commit
c9c5771782
@ -1,11 +1,12 @@
|
|||||||
<aside class="col-sm-3 offset-sm-1 blog-sidebar">
|
<aside class="col-sm-3 offset-sm-1 blog-sidebar">
|
||||||
{{ if isset .Site.Params.sidebar "about" }}
|
{{ if and (.Site.Params.sidebar) (isset .Site.Params.sidebar "about") }}
|
||||||
<section class="sidebar-module sidebar-module-inset">
|
<section class="sidebar-module sidebar-module-inset">
|
||||||
<h4>{{ i18n "about" }}</h4>
|
<h4>{{ i18n "about" }}</h4>
|
||||||
<p>{{ .Site.Params.sidebar.about | markdownify }}</p>
|
<p>{{ .Site.Params.sidebar.about | markdownify }}</p>
|
||||||
</section>
|
</section>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if .Site.Params.sidebar }}
|
||||||
{{ $num_recent_posts := (index .Site.Params.sidebar "num_recent_posts" | default 5) }}
|
{{ $num_recent_posts := (index .Site.Params.sidebar "num_recent_posts" | default 5) }}
|
||||||
|
|
||||||
<section class="sidebar-module">
|
<section class="sidebar-module">
|
||||||
@ -17,6 +18,8 @@
|
|||||||
</ol>
|
</ol>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ with .Site.Menus.sidebar }}
|
{{ with .Site.Menus.sidebar }}
|
||||||
<section class="sidebar-module">
|
<section class="sidebar-module">
|
||||||
<h4>{{ i18n "links" }}</h4>
|
<h4>{{ i18n "links" }}</h4>
|
||||||
|
Loading…
Reference in New Issue
Block a user