From 1cf39d95414262450f03e3854f01b77afd0ed102 Mon Sep 17 00:00:00 2001 From: "Dustin L. Dodson" Date: Sat, 30 May 2020 17:47:23 -0700 Subject: [PATCH] Add color-per-page support, render _index, change configs to JSON --- README.md | 127 +++++++++++++++-------------------- archetypes/posts.md | 22 +++--- layouts/_default/list.html | 7 +- layouts/partials/footer.html | 2 +- layouts/partials/head.html | 4 +- theme.json | 33 +++++++++ theme.toml | 13 ---- 7 files changed, 109 insertions(+), 99 deletions(-) create mode 100644 theme.json delete mode 100644 theme.toml diff --git a/README.md b/README.md index 83d1cce..5f2d42a 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/archetypes/posts.md b/archetypes/posts.md index cf19c25..e1338d1 100644 --- a/archetypes/posts.md +++ b/archetypes/posts.md @@ -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, +} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 93fe87c..b9949dc 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -14,6 +14,11 @@ {{ end }} {{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }} + {{ if len .Content }} +

{{.Title}}

+ {{ .Content }} + {{ end }} + {{ range $paginator.Pages }}

@@ -62,4 +67,4 @@ {{ end }} {{ partial "pagination.html" . }}

-{{ end }} +{{ end }} \ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 9e70410..46159eb 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -7,7 +7,7 @@ diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 43265f9..3b6e399 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -9,7 +9,9 @@ -{{ if (ne $.Site.Params.ThemeColor "orange") }} +{{ if (isset .Params "color") }} + +{{ else if (ne $.Site.Params.ThemeColor "orange") }} {{ end }} diff --git a/theme.json b/theme.json new file mode 100644 index 0000000..d0d40e2 --- /dev/null +++ b/theme.json @@ -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" + } +} \ No newline at end of file diff --git a/theme.toml b/theme.toml deleted file mode 100644 index 6f9c063..0000000 --- a/theme.toml +++ /dev/null @@ -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"