From 201f37c2fb0e87ee95293f726ef7f5c0779e4e15 Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Sun, 20 Aug 2023 22:41:00 +0200 Subject: Support for theme installation as hugo module --- README.md | 20 +++++++- exampleSite/.gitignore | 1 + exampleSite/README.md | 4 +- exampleSite/config.toml | 73 ---------------------------- exampleSite/content/about.md | 5 +- exampleSite/content/post/math-typesetting.md | 11 ++--- exampleSite/hugo.toml | 73 ++++++++++++++++++++++++++++ go.mod | 3 ++ layouts/_default/baseof.html | 2 +- 9 files changed, 105 insertions(+), 87 deletions(-) delete mode 100644 exampleSite/config.toml create mode 100644 exampleSite/hugo.toml create mode 100644 go.mod diff --git a/README.md b/README.md index 70334de..4177243 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,32 @@ This theme is especially optimized for Chinese characters, while works well with ![1](https://raw.githubusercontent.com/heyeshuang/hugo-theme-tokiwa/master/images/screenshot.png) ![2](https://raw.githubusercontent.com/heyeshuang/hugo-theme-tokiwa/master/images/screenshot02.png) -A live demo is at . +A live demo is at . ## Install +### Git submodule + Inside the folder of your Hugo site run: ```bash $ git submodule add https://github.com/heyeshuang/hugo-theme-tokiwa.git themes/hugo-theme-tokiwa ``` + +### Hugo module + +Inside the folder of your Hugo site run: +```bash +$ hugo mod init https://github.com// +$ hugo mod get https://github.com/heyeshuang/hugo-theme-tokiwa +``` + +Then add to your `hugo.toml`: +```toml +[module] +[[module.imports]] + path = "github.com/heyeshuang/hugo-theme-tokiwa" +``` + ## available config params ```toml diff --git a/exampleSite/.gitignore b/exampleSite/.gitignore index ca4d540..d28a87c 100644 --- a/exampleSite/.gitignore +++ b/exampleSite/.gitignore @@ -22,6 +22,7 @@ _testmain.go *.exe *.test +.hugo_build.lock /public /themes .DS_Store diff --git a/exampleSite/README.md b/exampleSite/README.md index aa38bb6..1f81e13 100644 --- a/exampleSite/README.md +++ b/exampleSite/README.md @@ -4,7 +4,7 @@ This repository offers an example site for [Hugo](https://gohugo.io/) and also i # Using -1. [Install Hugo](https://gohugo.io/overview/installing/) +1. [Install Hugo](https://gohugo.io/installation/) 2. Clone this repository ```bash git clone https://github.com/gohugoio/hugoBasicExample.git @@ -19,4 +19,4 @@ hugo server -t YOURTHEME - A section called `/post/` with sample markdown content - A headless bundle called `homepage` that you may want to use for single page applications. You can find instructions about headless bundles over [here](https://gohugo.io/content-management/page-bundles/#headless-bundle) - An `about.md` that is intended to provide the `/about/` page for a theme demo -6. If you intend to build a theme that does not fit in the content structure provided in this repository, then you are still more than welcome to submit it for review at the [Hugo Themes](https://github.com/gohugoio/hugoThemes/issues) respository +6. If you intend to build a theme that does not fit in the content structure provided in this repository, then you are still more than welcome to submit it for review at the [Hugo Themes](https://github.com/gohugoio/hugoThemes/issues) repository diff --git a/exampleSite/config.toml b/exampleSite/config.toml deleted file mode 100644 index 1a7a01b..0000000 --- a/exampleSite/config.toml +++ /dev/null @@ -1,73 +0,0 @@ -DefaultContentLanguage = "en" -author = "He Yeshuang" -baseURL = "https://example.com/" -copyright = "Copyright © 2008–2019" -disqusShortname = "YOURSHORTNAME" -enableInlineShortcodes = true -footnoteReturnLinkContents = "^" -googleAnalytics = "UA-FAKE" ## or "G-xxxxxxxx" in Google Analytics v4, in hugo v0.82+ -hasCJKLanguage = true -languageCode = "cn" -theme = "hugo-theme-tokiwa" -title = "Hugo Themes" - -[markup] -[markup.highlight] -style = "monokailight" - -[markup.goldmark.renderer] -unsafe = true - -[params] -bannerFont = "fonts/exampleFont" -description = """ -Tokiwa-iro is the theme color of this site. -""" -env = "production" # for Google Analytics and DISQUS. -favicon = "img/favicon-32x32.png" -fuse = true # for searchbox. "JSON" must added to output contents. See [outputs]. -math = true # for introducing $KaTEX$ -useChineseFonts = true -postDateFormat = "2006-1-2" - -[menu] -# Shown in the side menu. -[[menu.main]] -identifier = "post" -name = "Posts" -url = "/post/" -weight = 1 -[[menu.main]] -name = "Tags" -url = "/tags/" -weight = 2 - -[[menu.main]] -name = "Categories" -url = "/categories/" -weight = 2 - -[[menu.main]] -identifier = "about" -name = "About" -url = "/about/" -weight = 3 - -[taxonomies] -category = "categories" -series = "series" -tag = "tags" -[social] -bilibili = "http://example.com/" -github = "http://github.com/" -gitlab = "http://gitlab.com/" -instagram = "http://example.com/" -mail = "mailto:anon@example.com" -twitter = "http://twitter.com/" -weibo = "http://example.com/" -youtube = "http://youtube.com/" -zhihu = "http://example.com/" -# any icon in layouts/partials/svg can be used by the name without the "-line.svg" - -[outputs] -home = ["HTML", "RSS", "JSON"] diff --git a/exampleSite/content/about.md b/exampleSite/content/about.md index a412806..f77dfc1 100644 --- a/exampleSite/content/about.md +++ b/exampleSite/content/about.md @@ -20,9 +20,6 @@ Hugo is ideal for blogs, corporate websites, creative portfolios, online magazin Hugo is for people who want to hand code their own website without worrying about setting up complicated runtimes, dependencies and databases. -Websites built with Hugo are extremelly fast, secure and can be deployed anywhere including, AWS, GitHub Pages, Heroku, Netlify and any other hosting provider. +Websites built with Hugo are extremely fast, secure and can be deployed anywhere including, AWS, GitHub Pages, Heroku, Netlify and any other hosting provider. Learn more and contribute on [GitHub](https://github.com/gohugoio). - - - diff --git a/exampleSite/content/post/math-typesetting.md b/exampleSite/content/post/math-typesetting.md index 5bfc7ee..c3a51cb 100644 --- a/exampleSite/content/post/math-typesetting.md +++ b/exampleSite/content/post/math-typesetting.md @@ -19,16 +19,16 @@ In this example we will be using [KaTeX](https://katex.org/) {{ partial "math.html" . }} {{ end }} ``` -- To enable KaTex globally set the parameter `math` to `true` in a project's configuration -- To enable KaTex on a per page basis include the parameter `math: true` in content files. +- To enable KaTeX globally set the parameter `math` to `true` in a project's configuration +- To enable KaTeX on a per page basis include the parameter `math: true` in content files. **Note:** Use the online reference of [Supported TeX Functions](https://katex.org/docs/supported.html) {{< math.inline >}} {{ if or .Page.Params.math .Site.Params.math }} - - - + + + {{ end }} {{}} @@ -41,4 +41,3 @@ Block math: $$ \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } $$ - diff --git a/exampleSite/hugo.toml b/exampleSite/hugo.toml new file mode 100644 index 0000000..fda4cec --- /dev/null +++ b/exampleSite/hugo.toml @@ -0,0 +1,73 @@ +DefaultContentLanguage = "en" +author = "He Yeshuang" +baseURL = "https://example.com/" +copyright = "Copyright © 2008–2019" +disqusShortname = "YOURSHORTNAME" +enableInlineShortcodes = true +footnoteReturnLinkContents = "^" +googleAnalytics = "UA-FAKE" ## or "G-xxxxxxxx" in Google Analytics v4, in hugo v0.82+ +hasCJKLanguage = true +languageCode = "cn" +theme = "hugo-theme-tokiwa" +title = "Hugo Themes" + +[markup] +[markup.highlight] +style = "monokailight" + +[markup.goldmark.renderer] +unsafe = true + +[params] +bannerFont = "fonts/exampleFont" +description = """ +Tokiwa-iro is the theme color of this site. +""" +env = "production" # for Google Analytics and DISQUS. +favicon = "img/favicon-32x32.png" +fuse = true # for searchbox. "JSON" must added to output contents. See [outputs]. +math = true # for introducing $KaTeX$ +useChineseFonts = true +postDateFormat = "2006-1-2" + +[menu] +# Shown in the side menu. +[[menu.main]] +identifier = "post" +name = "Posts" +url = "/post/" +weight = 1 +[[menu.main]] +name = "Tags" +url = "/tags/" +weight = 2 + +[[menu.main]] +name = "Categories" +url = "/categories/" +weight = 2 + +[[menu.main]] +identifier = "about" +name = "About" +url = "/about/" +weight = 3 + +[taxonomies] +category = "categories" +series = "series" +tag = "tags" +[social] +bilibili = "http://example.com/" +github = "https://github.com/" +gitlab = "https://gitlab.com/" +instagram = "http://example.com/" +mail = "mailto:anon@example.com" +twitter = "https://twitter.com/" +weibo = "http://example.com/" +youtube = "https://youtube.com/" +zhihu = "http://example.com/" +# any icon in layouts/partials/svg can be used by the name without the "-line.svg" + +[outputs] +home = ["HTML", "RSS", "JSON"] diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..36044f4 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/heyeshuang/hugo-theme-tokiwa + +go 1.20 diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index d2de1c4..265ba3a 100755 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -68,7 +68,7 @@ src: url('{{ ( printf "%s%s" .Site.Params.bannerFont ".woff2") | absURL }}') format('woff2'), url('{{ ( printf "%s%s" .Site.Params.bannerFont ".woff") | absURL }}') format('woff'); } - /* For varible font usage sometimes */ + /* For variable font usage sometimes */ /* @font-face { font-family: 'Source Han Serif CN Variable'; -- cgit v1.2.3