cleanup and variablization

This commit is contained in:
Luke Smith 2022-06-28 19:06:38 -04:00
parent f729985265
commit d3a6b31e4a
8 changed files with 40 additions and 55 deletions

View File

@ -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"

View File

@ -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> &ndash;
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
</article>
{{ partial "footer.html" . }}

View File

@ -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" . }}

View File

@ -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> &ndash; <a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}</ul>
</article>
{{ partial "footer.html" . }}

View File

@ -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" . }}

View File

@ -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) }}&middot;{{ 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) }}&middot;{{ end -}}
{{- end -}}
</div>
{{ end }}
{{ end }}
{{- end -}}
{{- end -}}
</main>
<footer><a href="{{ .Site.BaseURL }}">{{ .Site.BaseURL }}</a></footer>
<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>

View File

@ -2,15 +2,18 @@
<html lang="{{ .Site.Language }}">
<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 }}">
<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" . }}
{{- partial "nav.html" . -}}
<main>

View File

@ -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 }}