Add color-per-page support, render _index, change configs to JSON

This commit is contained in:
Dustin L. Dodson 2020-05-30 17:47:23 -07:00
parent 0a9b08f405
commit 1cf39d9541
No known key found for this signature in database
GPG Key ID: B516853BBC1F3EBC
7 changed files with 109 additions and 99 deletions

127
README.md
View File

@ -66,78 +66,61 @@ $ git submodule add https://github.com/panr/hugo-theme-terminal.git themes/termi
The theme doesn't require any advanced configuration. Just copy:
```toml
baseurl = "/"
languageCode = "en-us"
theme = "terminal"
paginate = 5
[params]
# dir name of your blog content (default is `content/posts`)
contentTypeName = "posts"
# ["orange", "blue", "red", "green", "pink"]
themeColor = "orange"
# if you set this to 0, only submenu trigger will be visible
showMenuItems = 2
# show selector to switch language
showLanguageSelector = false
# set theme to full screen width
fullWidthTheme = false
# center theme with default width
centerTheme = false
# set a custom favicon (default is a `themeColor` square)
# favicon = "favicon.ico"
# set post to show the last updated
# If you use git, you can set `enableGitInfo` to `true` and then post will automatically get the last updated
showLastUpdated = false
# Provide a string as a prefix for the last update date. By default, it looks like this: 2020-xx-xx [Updated: 2020-xx-xx] :: Author
# updatedDatePrefix = "Updated"
# set all headings to their default size (depending on browser settings)
# it's set to `true` by default
# oneHeadingSize = false
[params.twitter]
# set Twitter handles for Twitter cards
# see https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started#card-and-content-attribution
# do not include @
creator = ""
site = ""
[languages]
[languages.en]
languageName = "English"
title = "Terminal"
subtitle = "A simple, retro theme for Hugo"
owner = ""
keywords = ""
copyright = ""
menuMore = "Show more"
readMore = "Read more"
readOtherPosts = "Read other posts"
missingContentMessage = "Page not found..."
missingBackButtonLabel = "Back to home page"
[languages.en.params.logo]
logoText = "Terminal"
logoHomeLink = "/"
[languages.en.menu]
[[languages.en.menu.main]]
identifier = "about"
name = "About"
url = "/about"
[[languages.en.menu.main]]
identifier = "showcase"
name = "Showcase"
url = "/showcase"
```json
{
"baseurl": "/",
"languageCode": "en-us",
"theme": "terminal",
"paginate": 5,
"params": {
"contentTypeName": "posts",
"themeColor": "orange",
"showMenuItems": 2,
"showLanguageSelector": false,
"fullWidthTheme": false,
"centerTheme": false,
"showLastUpdated": false,
"twitter": {
"creator": "",
"site": ""
}
},
"languages": {
"en": {
"languageName": "English",
"title": "Terminal",
"subtitle": "A simple, retro theme for Hugo",
"owner": "",
"keywords": "",
"copyright": "",
"menuMore": "Show more",
"readMore": "Read more",
"readOtherPosts": "Read other posts",
"missingContentMessage": "Page not found...",
"missingBackButtonLabel": "Back to home page",
"params": {
"logo": {
"logoText": "Terminal",
"logoHomeLink": "/"
}
},
"menu": {
"main": [
{
"identifier": "about",
"name": "About",
"url": "/about"
},
{
"identifier": "showcase",
"name": "Showcase",
"url": "/showcase"
}
]
}
}
}
}
```
to `config.toml` file in your Hugo root directory and change params fields. In case you need, here's [a YAML version](https://gist.github.com/panr/9eeea6f595c257febdadc11763e3a6d1).

View File

@ -1,11 +1,11 @@
+++
title = ""
date = ""
author = ""
authorTwitter = "" #do not include @
cover = ""
tags = ["", ""]
keywords = ["", ""]
description = ""
showFullContent = false
+++
{
"title": "",
"date": "",
"author": "",
"authorTwitter": "",
"cover": "",
"tags": ["", ""],
"keywords": ["", ""],
"description": "",
"showFullContent": false,
}

View File

@ -14,6 +14,11 @@
{{ end }}
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
{{ if len .Content }}
<h1>{{.Title}}</h1>
{{ .Content }}
{{ end }}
{{ range $paginator.Pages }}
<div class="post on-list">
<h1 class="post-title">
@ -62,4 +67,4 @@
{{ end }}
{{ partial "pagination.html" . }}
</div>
{{ end }}
{{ end }}

View File

@ -7,7 +7,7 @@
<div class="copyright">
<span>© {{ now.Year }} Powered by <a href="http://gohugo.io">Hugo</a></span>
{{end}}
<span>:: Theme made by <a href="https://twitter.com/panr">panr</a></span>
<span>:: Theme <i>originally</i> made by <a href="https://twitter.com/panr">panr</a></span>
</div>
</div>
</footer>

View File

@ -9,7 +9,9 @@
<!-- Theme CSS -->
<link rel="stylesheet" href="{{ "assets/style.css" | absURL }}">
{{ if (ne $.Site.Params.ThemeColor "orange") }}
{{ if (isset .Params "color") }}
<link rel="stylesheet" href="{{ (printf "assets/%s.css" .Params.color) | absURL }}">
{{ else if (ne $.Site.Params.ThemeColor "orange") }}
<link rel="stylesheet" href="{{ (printf "assets/%s.css" $.Site.Params.ThemeColor) | absURL }}">
{{ end }}

33
theme.json Normal file
View File

@ -0,0 +1,33 @@
{
"name": "terminal",
"license": "MIT",
"licenselink": "https://github.com/panr/hugo-theme-terminal/blob/master/LICENSE.md",
"description": "A simple, retro theme for Hugo.",
"homepage": "https://github.com/panr/hugo-theme-terminal/",
"tags": [
"blog",
"clean",
"customizable",
"dark",
"highlighting",
"minimal",
"monotone",
"multilingual",
"personal",
"responsive",
"simple",
"technical",
"retro"
],
"features": [
"blog",
"shortcode",
"syntax highlighting"
],
"min_version": 0.57,
"author": {
"name": "panr",
"homepage": "https://radoslawkoziel.pl",
"twitter": "https://twitter.com/panr"
}
}

View File

@ -1,13 +0,0 @@
name = "terminal"
license = "MIT"
licenselink = "https://github.com/panr/hugo-theme-terminal/blob/master/LICENSE.md"
description = "A simple, retro theme for Hugo."
homepage = "https://github.com/panr/hugo-theme-terminal/"
tags = ["blog", "clean", "customizable", "dark", "highlighting", "minimal", "monotone", "multilingual", "personal", "responsive", "simple", "technical", "retro"]
features = ["blog", "shortcode", "syntax highlighting"]
min_version = 0.57
[author]
name = "panr"
homepage = "https://radoslawkoziel.pl"
twitter = "https://twitter.com/panr"