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

github.com/htdvisser/hugo-base16-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHylke Visser <htdvisser@gmail.com>2018-04-02 12:01:13 +0300
committerHylke Visser <htdvisser@gmail.com>2018-04-02 12:28:19 +0300
commit7b2da739c813cd680e44606d2150e3c66a6794e6 (patch)
treef25c11016c9ec94f27f928ca00fe0173b71dda59
parent6314cdbd69f11632fe4034d1fe195890c67c2283 (diff)
Make html/template directives consistent
- Use relURL - Use $.Param - Remove $dateMissing - Links to category/tag page
-rw-r--r--layouts/partials/article-list-item.html3
-rw-r--r--layouts/partials/article.html10
-rw-r--r--layouts/partials/footer.html3
-rw-r--r--layouts/partials/header.html12
-rw-r--r--layouts/partials/hero.html2
5 files changed, 16 insertions, 14 deletions
diff --git a/layouts/partials/article-list-item.html b/layouts/partials/article-list-item.html
index 37696c5..10b8fce 100644
--- a/layouts/partials/article-list-item.html
+++ b/layouts/partials/article-list-item.html
@@ -1,8 +1,7 @@
-{{ $dateMissing := eq .Date.Year 1}}
<article class="list-item" itemscope itemtype="http://schema.org/Blog">
<h2 class="headline" itemprop="headline"><a href="{{ .RelPermalink }}">{{ .Title }}{{ if .Draft }} (Draft){{ end }}</a></h2>
<div class="meta">
-{{ if eq $dateMissing false }}
+{{ if not .Date.IsZero }}
<span class="key">published on</span>
<span class="val"><time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "January 02, 2006" }}</time></span>
{{ end }}
diff --git a/layouts/partials/article.html b/layouts/partials/article.html
index 834cbdb..c69a76f 100644
--- a/layouts/partials/article.html
+++ b/layouts/partials/article.html
@@ -1,15 +1,15 @@
-{{ $baseurl := .Site.BaseURL }}{{ $dateMissing := eq .Date.Year 1}}
+{{ $page := .Page }}
<article class="single" itemscope itemtype="http://schema.org/BlogPosting">
<div class="meta">
-{{ if eq $dateMissing false }}
+{{ if not .Page.Date.IsZero }}
<span class="key">published on</span>
<span class="val"><time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "January 02, 2006" }}</time></span>
{{ end }}
{{ with .Params.categories }}
- <span class="key">{{ if eq $dateMissing true }}published {{ end }}in</span>
+ <span class="key">{{ if $page.Date.IsZero }}published {{ end }}in</span>
<span class="val">
{{ range . }}
- <a href="{{ $baseurl }}categories/{{ . | urlize }}">{{ . }}</a>
+ <a href="{{ . | printf "categories/%s" | relURL }}">{{ . }}</a>
{{ end }}
</span>
{{ end }}
@@ -18,7 +18,7 @@
<span class="key">tags:</span>
<span class="val">
{{ range . }}
- <a href="{{ $baseurl }}tags/{{ . | urlize }}">{{ . }}</a>
+ <a href="{{ . | printf "tags/%s" | relURL }}">{{ . }}</a>
{{ end }}
</span>
{{ end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index d4f899c..13b47a3 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,9 +1,8 @@
-{{ $dateMissing := eq .Date.Year 1}}
</div>
<footer>
<div class="container">
- <span class="copyright">&copy; {{ if eq $dateMissing true }}{{ .Site.LastChange.Format "2006" }}{{ else }}{{ .Date.Format "2006" }} {{ end }} {{ .Site.Title }} - <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></span>
+ <span class="copyright">&copy; {{ .Site.LastChange.Year }} {{ .Site.Title }} - <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></span>
</div>
</footer>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index f6661cc..715808c 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -3,13 +3,17 @@
<head>
<meta charset="utf-8">
<meta name="description" content="{{ if eq .Description "" }}{{ .Site.Params.description }}{{ else }}{{ .Description }}{{ end }}">
-<meta name="keywords" content="{{ delimit .Keywords "," }}">
-<meta name="author" content="{{ .Site.Params.author }}">
+{{- with $.Param "keywords" }}
+<meta name="keywords" content="{{ delimit . "," }}">
+{{- end }}
+{{- with $.Param "author" }}
+<meta name="author" content="{{ . }}">
+{{- end }}
{{ .Hugo.Generator }}
<meta name="viewport" content="width=device-width, initial-scale=1">
-<link rel="stylesheet" href="{{ "css/style.css" | absURL }}" type="text/css">
+<link rel="stylesheet" href="{{ "css/style.css" | relURL }}" type="text/css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700" type="text/css">
-<link rel="alternate" href="{{ "index.xml" | absURL }}" type="application/rss+xml" title="{{ .Site.Title }}">
+<link rel="alternate" href="{{ "index.xml" | relURL }}" type="application/rss+xml" title="{{ .Site.Title }}">
<title>{{ $isHomePage := eq .Title .Site.Title }}{{ .Title }}{{ if eq $isHomePage false }} - {{ .Site.Title }}{{ end }}</title>
</head>
<body>
diff --git a/layouts/partials/hero.html b/layouts/partials/hero.html
index e00b3f6..a1580ed 100644
--- a/layouts/partials/hero.html
+++ b/layouts/partials/hero.html
@@ -5,7 +5,7 @@
</h1>
<div class="hero-logo">
- <img src="{{ $baseurl }}img/base16-eighties.svg">
+ <img src="{{ "img/base16-eighties.svg" | relURL }}">
</div>
<div style="text-align: center;">