commit d3a6b31e4a2864a61a3cad0a339c626c38460bad
parent f729985265541eab295f6d1fe2b2008bb23a034a
Author: Luke Smith <Luke Smith>
Date: Tue, 28 Jun 2022 19:06:38 -0400
cleanup and variablization
Diffstat:
8 files changed, 40 insertions(+), 55 deletions(-)
diff --git a/config.toml b/config.toml
@@ -1,11 +1,8 @@
+title = "Website Name"
baseURL = 'https://example.org'
languageCode = 'en-us'
-title = "Website Name"
-# [menu]
-# [[menu.main]]
-# identifier = 'home'
-# name = 'Home'
-# pre = "🏡"
-# url = '/index.html'
-# weight = -110
+[params]
+ #relatedtext = "Related:"
+ favicon = "/favicon.ico"
+ stylesheet = "/style.css"
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
@@ -1,22 +1,14 @@
{{ partial "header.html" . }}
-
<header><h1>{{ .Title }}</h1></header>
-
<article>
-
{{ .Content }}
-
<ul>
{{ range.Pages }}
-
<li>
<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006 Jan 02" }}</time> –
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</li>
-
{{ end }}
</ul>
-
</article>
-
{{ partial "footer.html" . }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
@@ -1,11 +1,6 @@
{{ partial "header.html" . }}
-
<header><h1>{{ with .Params.icon }}<img src="/pix/{{ . }}" class=titleicon>{{ end }}{{ .Title }}</h1></header>
-
<article>{{ with .Params.img }}<img src="/pix/{{ . }}" class=titleimg>{{ end }}
-
{{ .Content }}
-
</article>
-
{{ partial "footer.html" . }}
diff --git a/layouts/_default/tag.html b/layouts/_default/tag.html
@@ -1,14 +1,9 @@
{{ partial "header.html" . }}
-
<header><h1 id="tag_{{ .Title }}">{{ .Title | title }}</h1></header>
-
<article>
-
{{ .Content }}
<ul class=tagartlist>
{{ range.Pages }}<li><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006 Jan 02" }}</time> – <a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}</ul>
-
</article>
-
{{ partial "footer.html" . }}
diff --git a/layouts/index.html b/layouts/index.html
@@ -1,7 +1,4 @@
-{{ partial "header.html" . }}
-
+{{ partial "header.html" . -}}
<header><h1>{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}</h1></header>
-
{{ .Content }}
-
{{ partial "footer.html" . }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
@@ -1,17 +1,20 @@
- {{ if isset .Params "tags" }}
- {{ $tagsLen := len .Params.tags }}
- {{ if gt $tagsLen 0 }}
+ {{- if isset .Params "tags" -}}
+ {{- $tagsLen := len .Params.tags -}}
+ {{- if gt $tagsLen 0 -}}
<div class=taglist>
- See related:<br>
- {{ range $k, $v := .Params.tags }}
- {{ $url := printf "tags/%s" (. | urlize | lower) }}
- <a href="{{ $url | absURL }}">{{ . | title }}</a>
- {{ if lt $k (sub $tagsLen 1) }}·{{ end }}
- {{ end }}
+ {{ with .Site.Params.relatedtext }}{{ . }}<br>{{ end }}
+ {{- range $k, $v := .Params.tags -}}
+ {{- $url := printf "tags/%s" (. | urlize | lower) -}}
+ <a id="tag_{{ . }}" href="{{ $url | absURL }}">{{ . | title }}</a>
+ {{- if lt $k (sub $tagsLen 1) }}·{{ end -}}
+ {{- end -}}
</div>
- {{ end }}
- {{ end }}
- </main>
- <footer><a href="{{ .Site.BaseURL }}">{{ .Site.BaseURL }}</a></footer>
+ {{- end -}}
+ {{- end -}}
+</main>
+<footer>
+ <a href="{{ .Site.BaseURL }}">{{ .Site.BaseURL }}</a></br>
+ <a href="/index.xml"><img src="/pix/rss.svg" style="max-height:.9em;display:inline" alt=""> Subscribe via RSS for Updates.</a></footer>
+</footer>
</body>
</html>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
@@ -1,16 +1,19 @@
<!DOCTYPE html>
<html lang="{{ .Site.Language }}">
- <head>
+<head>
<title>{{ if not .IsHome }}{{ .Title | title }} | {{ end }}{{ .Site.Title }}</title>
- <meta charset="utf-8"/>
- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
- <link rel='stylesheet' type='text/css' href='/style.css'>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="keywords" content="{{ with .Params.tags }}{{ delimit . ", " }}{{ end }}">
- <link rel='alternate' type='application/rss+xml' title="{{ .Site.Title }} RSS" href='/rss.xml'>
<link rel="canonical" href="{{ .Site.BaseURL }}">
+ <link rel='alternate' type='application/rss+xml' title="{{ .Site.Title }} RSS" href='/index.xml'>
+ {{ with .Site.Params.stylesheet }}<link rel='stylesheet' type='text/css' href='{{ . }}'>
+ {{ end -}}
+ {{ with .Site.Params.favicon }}<link rel="icon" href="{{ . }}">
+ {{ end -}}
<meta name="description" content="{{ with .Params.description }}{{ . }}{{ else }}{{ .Summary }}{{ end }}">
- </head>
+ <meta name="keywords" content="{{ with .Params.tags }}{{ delimit . ", " }}{{ end }}">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="robots" content="index, follow">
+ <meta charset="utf-8">
+</head>
<body>
- {{ partial "nav.html" . }}
- <main>
+{{- partial "nav.html" . -}}
+<main>
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
@@ -1,7 +1,10 @@
+{{- if .Site.Menus.main }}
<nav>
- <ul>{{ $sec := .Page.Section }}{{ $file := .File.TranslationBaseName }}
+ <ul>
+ {{- $sec := .Page.Section }}{{ $file := .File.TranslationBaseName -}}
{{ range.Site.Menus.main }}{{ $base := path.Base .URL }}
<a {{ if or ( eq $sec $base ) ( eq $file $base ) ( and (eq $sec "") ( eq $file "_index") (eq $base "/") ) }}class="menuactive" {{ end }}href="{{ .URL }}"><li><span class=pre>{{ .Pre }}</span><span class=menuname>{{ .Name }}</span></li></a>
- {{ end }}
+ {{- end }}
</ul>
</nav>
+{{- end }}