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: The theme doesn't require any advanced configuration. Just copy:
```toml ```json
baseurl = "/" {
languageCode = "en-us" "baseurl": "/",
theme = "terminal" "languageCode": "en-us",
paginate = 5 "theme": "terminal",
"paginate": 5,
[params] "params": {
# dir name of your blog content (default is `content/posts`) "contentTypeName": "posts",
contentTypeName = "posts" "themeColor": "orange",
"showMenuItems": 2,
# ["orange", "blue", "red", "green", "pink"] "showLanguageSelector": false,
themeColor = "orange" "fullWidthTheme": false,
"centerTheme": false,
# if you set this to 0, only submenu trigger will be visible "showLastUpdated": false,
showMenuItems = 2 "twitter": {
"creator": "",
# show selector to switch language "site": ""
showLanguageSelector = false }
},
# set theme to full screen width "languages": {
fullWidthTheme = false "en": {
"languageName": "English",
# center theme with default width "title": "Terminal",
centerTheme = false "subtitle": "A simple, retro theme for Hugo",
"owner": "",
# set a custom favicon (default is a `themeColor` square) "keywords": "",
# favicon = "favicon.ico" "copyright": "",
"menuMore": "Show more",
# set post to show the last updated "readMore": "Read more",
# If you use git, you can set `enableGitInfo` to `true` and then post will automatically get the last updated "readOtherPosts": "Read other posts",
showLastUpdated = false "missingContentMessage": "Page not found...",
# 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 "missingBackButtonLabel": "Back to home page",
# updatedDatePrefix = "Updated" "params": {
"logo": {
# set all headings to their default size (depending on browser settings) "logoText": "Terminal",
# it's set to `true` by default "logoHomeLink": "/"
# oneHeadingSize = false }
},
[params.twitter] "menu": {
# set Twitter handles for Twitter cards "main": [
# see https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started#card-and-content-attribution {
# do not include @ "identifier": "about",
creator = "" "name": "About",
site = "" "url": "/about"
},
[languages] {
[languages.en] "identifier": "showcase",
languageName = "English" "name": "Showcase",
title = "Terminal" "url": "/showcase"
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"
``` ```
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). 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 = "" "title": "",
date = "" "date": "",
author = "" "author": "",
authorTwitter = "" #do not include @ "authorTwitter": "",
cover = "" "cover": "",
tags = ["", ""] "tags": ["", ""],
keywords = ["", ""] "keywords": ["", ""],
description = "" "description": "",
showFullContent = false "showFullContent": false,
+++ }

View File

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

View File

@ -7,7 +7,7 @@
<div class="copyright"> <div class="copyright">
<span>© {{ now.Year }} Powered by <a href="http://gohugo.io">Hugo</a></span> <span>© {{ now.Year }} Powered by <a href="http://gohugo.io">Hugo</a></span>
{{end}} {{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>
</div> </div>
</footer> </footer>

View File

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