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 --> <!-- Ranges through content/post/*.md -->
{{ range .Data.Pages.ByPublishDate }} {{ if not (eq .Section "blog") }} {{ range .Data.Pages.ByPublishDate }} {{ if not (eq .Section "blog") }}
<li> <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> </li>
{{ end }} {{ end }} {{ end }} {{ end }}
</ul> </ul>

View file

@ -29,7 +29,7 @@
<!-- Ranges through content/post/*.md --> <!-- Ranges through content/post/*.md -->
{{ range .Data.Pages.ByPublishDate }} {{ range .Data.Pages.ByPublishDate }}
<li> <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> </li>
{{ end }} {{ end }}
</ul> </ul>

View file

@ -4,7 +4,7 @@
<div class="section" id="top"><!-- Parent section --> <div class="section" id="top"><!-- Parent section -->
<div class="container hero {{ if .Site.Params.fadeIn }} fade-in one {{ end }}"><!-- Begin Title --> <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 --> </div><!-- End Title -->
<!-- Everything below fades in two! --> <!-- Everything below fades in two! -->
@ -19,7 +19,7 @@
{{ if .Site.Params.showLatest }} {{ if .Site.Params.showLatest }}
<h2 class="title is-2 top-pad">Latest Post</h2> <h2 class="title is-2 top-pad">Latest Post</h2>
{{ range first 1 (where .Data.Pages.ByPublishDate.Reverse "Section" "blog") }} {{ range first 1 (where .Data.Pages.ByPublishDate.Reverse "Section" "blog") }}
<div class="summary">{{ .Date.Format .Site.Params.dateForm }} <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> <h3 class="title is-3 strong-post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
<div class="markdown"> <div class="markdown">
{{ .Summary }} {{ .Summary }}

View file

@ -4,7 +4,7 @@
<div class="section" id="top"><!-- Parent section --> <div class="section" id="top"><!-- Parent section -->
<div class="container hero {{ if .Site.Params.fadeIn }} fade-in one {{ end }}"><!-- Begin Title --> <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 --> </div><!-- End Title -->
<!-- Everything below fades in two! --> <!-- Everything below fades in two! -->
@ -17,7 +17,7 @@
<div class="container {{ if .Site.Params.fadeIn }} fade-in two {{ end }}"><!-- Begin blog title container --> <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> <h2 class="title is-1 top-pad strong-post-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class="post-data"> <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 }} {{ if eq 1 .ReadingTime }}{{ .ReadingTime }} minute read{{ else }}{{ .ReadingTime }} minutes read{{ end }}
</div> </div>

View file

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

View file

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

View file

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

View file

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

View file

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