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

github.com/syui/hugo-theme-air.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Verkhoturov <paskal.07@gmail.com>2018-03-24 23:39:24 +0300
committersyui <syui@syui.cf>2019-02-24 22:15:04 +0300
commitcb25c1c04a6a3758cdfaf26d39d3ad797d4bb95d (patch)
tree41328fa01d7b405204ffd12d4ed6dccceafbbe43
parent436f5f24168865fc13459440cd4bbe97c8ddbf41 (diff)
set default if no value is set for variables which require that
-rw-r--r--layouts/_default/single.html16
-rw-r--r--layouts/partials/author.html2
2 files changed, 10 insertions, 8 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 3863806..82ab1e7 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,11 +1,11 @@
{{ partial "header.html" . }}
-{{ $baseurl := .Site.BaseURL }}
+{{ $baseurl := default "/" .Site.BaseURL }}
+
+<header class="main-header " style="background-image: url({{$baseurl}}{{.Site.Params.cover}})">
-<header class="main-header " style="background-image: url({{.Site.BaseURL}}{{.Site.Params.cover}})">
-
<nav class="main-nav overlay clearfix">
{{ if .Site.Params.logo }}
- <a class="blog-logo" href="{{ .Site.BaseURL }}"><img src="{{ .Site.BaseURL }}{{.Site.Params.logo}}" alt="Blog Logo" /></a>
+ <a class="blog-logo" href="{{ $baseurl }}"><img src="{{ $baseurl }}{{.Site.Params.logo}}" alt="Blog Logo" /></a>
{{end}}
<!--
{{ if .Site.Menus.main }}
@@ -44,11 +44,11 @@
</time>
{{end}}
{{ range .Params.tags }}
- <span class="post-tag small"><a href="{{.Site.BaseURL}}tags/{{ . | urlize }}/">#{{ . }}</a></span>
+ <span class="post-tag small"><a href="{{$baseurl}}tags/{{ . | urlize }}/">#{{ . }}</a></span>
{{ end }}
</section>
</header>
-
+
<section class="post-content">
{{ .Content }}
</section>
@@ -59,8 +59,8 @@
{{if .Site.Params.logo}}
<figure class="author-image">
-
- <a class="img" href="{{.Site.BaseURL}}" style="background-image: url({{.Site.BaseURL}}{{.Site.Params.logo}})"><span class="hidden">{{ .Site.Params.author }}</span></a>
+
+ <a class="img" href="{{$baseurl}}" style="background-image: url({{$baseurl}}{{.Site.Params.logo}})"><span class="hidden">{{ .Site.Params.author }}</span></a>
</figure>
{{end}}
diff --git a/layouts/partials/author.html b/layouts/partials/author.html
index c658cd2..00d2b1f 100644
--- a/layouts/partials/author.html
+++ b/layouts/partials/author.html
@@ -1,4 +1,6 @@
<section class="author">
+{{ if isset .Site.Params "author" }}
<p>{{ .Site.Params.author }}</p>
<!--<p>Read <a href="{{ .Site.BaseURL }}">more posts</a> by this author.</p>-->
+{{ end }}
</section>