Footer text now is fully optional

This commit is contained in:
Serghei Iakovlev 2022-05-28 13:14:33 +02:00
parent b40abdfab1
commit 512e94b28b
No known key found for this signature in database
GPG key ID: C6AF1016BBDEA800
4 changed files with 28 additions and 18 deletions
CHANGELOG.md
exampleSite
layouts/partials

View file

@ -14,7 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add fallback if main sections are not configured
- Reformat default 404 page
- Rework the "Latest Publications" section, add post date
- Add 404 page to robots.txt file (to prevent search engines from indexing it)
- Add 404 page to robots.txt file (to prevent search engines from indexing it)
- Footer text now is fully optional (do not show default text if it is empty)
### Fixed

View file

@ -128,14 +128,15 @@ disableKinds = ['RSS']
[params]
# Site description. Used in meta description
description = 'Ed is a Hugo theme designed for textual editors based on minimal computing principles, and focused on legibility and flexibility.'
# Copyright string
# Copyright string. "{year}" will be replaced by © and the current year.
copyright = 'Copyright © 2019-{year} John Doe'
# Color scheme. Options: red, orange, magenta, cyan, blue, brown
colorScheme = ''
# Used in site header
tagline = 'a Hugo theme for minimal editions'
# Custom footer text
footer = ''
# Custom footer text on left sidebar. Use HTMl if needed.
# "{year}" will be replaced by © and the current year.
footer = 'Built with <a href="https://github.com/sergeyklay/gohugo-theme-ed" target="_blank" rel="noopener noreferrer">Ed</a>. Distributed under an MIT license.'
# Sections to be displayed in the main page, as well as RSS/Atom feeds
mainSections = ['posts', 'dramas', 'narratives', 'poems']
# Order of post meta information

View file

@ -1,6 +1,6 @@
---
title: "O Captain! My Captain!"
date: 2022-02-02T23:56:58+02:00
date: 2021-02-02T23:56:58+02:00
draft: false
author: Walt Whitman
editor: Alex Gil

View file

@ -1,13 +1,21 @@
<div class="sidebar-item">
<p>
{{- with site.Params.footer -}}
{{- $footer_text := replace . "{year}" now.Year -}}
{{- $footer_text = replace $footer_text "&copy;" "©" }}
{{ $footer_text | safeHTML }}
{{- else }}{{- /* TODO: translate strings */ -}}
{{- with .Params.editor }}<p>Edited by {{ . }}, {{ now.Format "2006" }}.</p>{{ end }}
Built with <a href="https://github.com/sergeyklay/gohugo-theme-ed" target="_blank" rel="noopener noreferrer">Ed.</a>
Distributed under an MIT license.
{{- end }}
</p>
</div>
{{ if or site.Params.footer .Params.editor }}
<div class="sidebar-item">
<p>
{{ with site.Params.footer }}
{{ $footerText := replace . "{year}" now.Year }}
{{ $footerText | safeHTML }}
{{ end }}
{{ with .Params.editor }}
<p>
Edited by {{ . }},
{{ if not $.Params.Lastmod.IsZero }}
{{ $.Params.Lastmod.Format "2006" }}
{{ else }}
{{ now.Format "2006" }}
{{ end }}
.
</p>
{{ end }}
</p>
</div>
{{ end }}