set default if no configuration is set for variables which require that (#36)

This commit is contained in:
Dmitry Verkhoturov 2018-03-25 18:08:39 +03:00 committed by Vicky Lai
parent a459b3808f
commit f4568a4589
9 changed files with 21 additions and 21 deletions

View file

@ -29,7 +29,7 @@
<!-- Ranges through content/post/*.md -->
{{ range .Data.Pages.ByPublishDate }} {{ if not (eq .Section "blog") }}
<li>
<a href="{{.Permalink}}">{{.Date.Format .Site.Params.dateForm }} | {{.Title}}</a>
<a href="{{.Permalink}}">{{.Date.Format (.Site.Params.dateform | default "Jan 02, 2006") }} | {{.Title}}</a>
</li>
{{ end }} {{ end }}
</ul>
@ -62,4 +62,4 @@
})
</script>
</body>
</body>

View file

@ -29,7 +29,7 @@
<!-- Ranges through content/post/*.md -->
{{ range .Data.Pages.ByPublishDate }}
<li>
<a href="{{.Permalink}}">{{.Date.Format .Site.Params.dateForm }} | {{.Title}}</a>
<a href="{{.Permalink}}">{{.Date.Format (.Site.Params.dateform | default "Jan 02, 2006") }} | {{.Title}}</a>
</li>
{{ end }}
</ul>
@ -62,4 +62,4 @@
})
</script>
</body>
</body>

View file

@ -4,7 +4,7 @@
<div class="section" id="top"><!-- Parent section -->
<div class="container hero {{ if .Site.Params.fadeIn }} fade-in one {{ end }}"><!-- Begin Title -->
<h1 class="bold-title is-1">{{ .Site.Params.blogHead }}</h1>
<h1 class="bold-title is-1">{{ .Site.Params.blogHead | default "Blog" }}</h1>
</div><!-- End Title -->
<!-- Everything below fades in two! -->
@ -13,13 +13,13 @@
<div class="container"><!-- Begin Nav bar -->
{{ partial "nav-list.html" . }}
</div><!-- End Nav bar -->
<div class="container"><!-- Begin Blog container -->
{{ if .Site.Params.showLatest }}
<h2 class="title is-2 top-pad">Latest Post</h2>
{{ range first 1 (where .Data.Pages.ByPublishDate.Reverse "Section" "blog") }}
<div class="summary">{{ .Date.Format .Site.Params.dateForm }}
{{ range first 1 (where .Data.Pages.ByPublishDate.Reverse "Section" "blog") }}
<div class="summary">{{ .Date.Format (.Site.Params.dateform | default "Jan 02, 2006") }}
<h3 class="title is-3 strong-post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
<div class="markdown">
{{ .Summary }}

View file

@ -4,7 +4,7 @@
<div class="section" id="top"><!-- Parent section -->
<div class="container hero {{ if .Site.Params.fadeIn }} fade-in one {{ end }}"><!-- Begin Title -->
<h1 class="bold-title is-1">{{ .Site.Params.blogHead }}</h1>
<h1 class="bold-title is-1">{{ .Site.Params.blogHead | default "Blog" }}</h1>
</div><!-- End Title -->
<!-- Everything below fades in two! -->
@ -17,7 +17,7 @@
<div class="container {{ if .Site.Params.fadeIn }} fade-in two {{ end }}"><!-- Begin blog title container -->
<h2 class="title is-1 top-pad strong-post-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class="post-data">
{{ .Date.Format .Site.Params.dateForm }} |
{{ .Date.Format (.Site.Params.dateform | default "Jan 02, 2006") }} |
{{ if eq 1 .ReadingTime }}{{ .ReadingTime }} minute read{{ else }}{{ .ReadingTime }} minutes read{{ end }}
</div>
@ -87,4 +87,4 @@ $('a[href^="{{ .Permalink }}#"]').click(function(e) {
})
</script>
</body>
</body>

View file

@ -3,14 +3,14 @@
<div id="top"> <!-- Where all the awesome begins -->
<div class="hero is-{{ .Site.Params.introHeight }}">
<div class="hero is-{{ .Site.Params.introHeight | default "fullheight" }}">
<!-- Possible hero-head not used -->
<!-- Super sweet Hero body title -->
<div class="hero-body">
<div class="container has-text-centered">
<!-- Title and tagline -->
<h1 class="bold-title {{ if .Site.Params.fadeIn }}fade-in one{{ end }}">
Hi, I'm {{ .Site.Params.firstName }}.
Hi, I'm {{ .Site.Params.firstName | default "Introduction" }}.
</h1>
<h3 class="subtitle is-3 {{ if.Site.Params.fadeIn }} fade-in two{{ end }}">
{{ .Site.Params.tagLine }}

View file

@ -2,8 +2,8 @@
{{ if .Site.Params.showLatest }}
<h2 class="title is-2 has-text-centered">Latest Post</h2>
{{ range first 1 (where .Data.Pages.ByPublishDate.Reverse "Section" "blog") }}
<div class="summary">{{ .Date.Format .Site.Params.dateForm }}
{{ range first 1 (where .Data.Pages.ByPublishDate.Reverse "Section" "blog") }}
<div class="summary">{{ .Date.Format (.Site.Params.dateform | default "Jan 02, 2006") }}
<h3 class="title is-3 latest-post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
<div class="markdown">
{{ .Summary }}

View file

@ -46,14 +46,14 @@ crossorigin="anonymous"></script>
{{ if .Site.Params.cacheBuster }}
{{ $t := now.Unix }}
<link rel="stylesheet" href="css/{{ .Site.Params.themeStyle }}-style.css?t={{$t}}">
<link rel="stylesheet" href="css/{{ .Site.Params.themeStyle | default "dark" }}-style.css?t={{$t}}">
{{range .Site.Params.extraCSSFiles}}
<link rel="stylesheet" href="{{.}}?t={{$t}}">
{{ end }}
{{ else }}
<link rel="stylesheet" href="css/{{ .Site.Params.themeStyle }}-style.css">
<link rel="stylesheet" href="css/{{ .Site.Params.themeStyle | default "dark" }}-style.css">
{{range .Site.Params.extraCSSFiles}}
<link rel="stylesheet" href="{{.}}">
{{end}}

View file

@ -1,3 +1,3 @@
<li class="post-item">
<span><a href="{{ .Permalink }}">{{ .Title }}</a></span> - <span>{{ .Date.Format .Site.Params.dateForm }}</span>
</li>
<span><a href="{{ .Permalink }}">{{ .Title }}</a></span> - <span>{{ .Date.Format (.Site.Params.dateform | default "Jan 02, 2006") }}</span>
</li>

View file

@ -5,8 +5,8 @@
<div class="section is-small">
<div class="columns is-multiline">
{{ range sort .Pages }} {{ if eq .Section "projects" }}
{{ if eq .Site.Params.projectColumns "2" }}
<div class="column is-half"> {{ else if eq .Site.Params.projectColumns "3" }}
{{ if eq (.Site.Params.projectColumns | default "3") "2" }}
<div class="column is-half"> {{ else if eq (.Site.Params.projectColumns | default "3") "3" }}
<div class="column is-one-third"> {{ end }}
<!-- Hey Vicky, show half column if number is even. -->
<div {{ if not .Params.external_link }} id="project{{.Title | urlize}}" {{ end }} class="card">