Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/curttimson/hugo-theme-dopetrope.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCurtis Timson <curt@live.co.uk>2018-02-12 22:23:20 +0300
committerCurtis Timson <curt@live.co.uk>2018-02-12 22:23:20 +0300
commita1af787ae82e032f4ace835bb0caeb7dc00aaed6 (patch)
treea013389e8cfa8952a56a2cbd5ea52d8c0940ba5f
parentdbd9f3cbb73b9c6a608b56c84c657af647925b7d (diff)
:sparkles: HIde blog link in nav when no posts
-rw-r--r--layouts/partials/nav.html5
1 files changed, 4 insertions, 1 deletions
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index 260cc1c..bb524a7 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -5,14 +5,17 @@
<li>
<a href="{{ .Site.BaseURL }}#portfolio">My Portfolio</a>
</li>
+ {{ $blogPosts := first 5 (where .Site.Pages "Type" .Site.Params.Blog.foldername) }}
+ {{ if $blogPosts }}
<li>
<a href="{{ .Site.BaseURL }}{{ .Site.Params.Blog.foldername }}">{{ .Site.Params.Blog.title }}</a>
<ul>
- {{ range first 5 (where .Site.Pages "Type" .Site.Params.Blog.foldername) }}
+ {{ range $blogPosts }}
<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</li>
+ {{ end }}
<li><a href="{{ .Site.BaseURL }}#contact">Contact</a></li>
</ul>
</nav> \ No newline at end of file