From 4dd01ec2c4072dcca30f50a13110b210daf5df1f Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Mon, 14 Aug 2023 22:11:17 +0200 Subject: [PATCH] Offer theme as hugo module --- README.md | 32 ++++++++++++++++++-- exampleSite/.hugo_build.lock | 0 exampleSite/README.md | 2 +- exampleSite/content/post/math-typesetting.md | 4 +-- exampleSite/{config.toml => hugo.toml} | 0 go.mod | 3 ++ 6 files changed, 35 insertions(+), 6 deletions(-) delete mode 100644 exampleSite/.hugo_build.lock rename exampleSite/{config.toml => hugo.toml} (100%) create mode 100644 go.mod diff --git a/README.md b/README.md index bb573a7..ab9450a 100755 --- a/README.md +++ b/README.md @@ -56,18 +56,44 @@ disqusShortname = 'YOUR_DISQUS_SHORTNAME' # use disqus comments monoDarkIcon = true # show monochrome dark mode icon gravatarCdn = 'GRAVATAR_CDN_LINK' # e.g. 'https://cdn.v2ex.com/gravatar/' graphCommentId = "YOUR_GRAPH_COMMENT_ID" # use graph comment (disqus alternative) - math = true # enable KaTex math typesetting globally + math = true # enable KaTeX math typesetting globally ``` Available options to front matter: ```toml comments = false # disable comments for a specific page -math = true # enable KaTex math typesetting for a specific page +math = true # enable KaTeX math typesetting for a specific page ``` ## Install +### As hugo module + +Inside the folder of your Hugo project, run: + +```bash +hugo mod init github.com// +``` + +Add paper theme ad dependency of your site: + +```bash +hugo mod init github.com// +``` + +Open `config.toml` or `hugo.toml`, remove the `theme` line (if present) and add module section at the bottom of the file: + +```toml +[module] + [[module.imports]] + path = "github.com/nanxiaobei/hugo-paper" +``` + +For more information, please read the [official guide](https://gohugo.io/hugo-modules/use-modules/#use-a-module-for-a-theme) of Hugo. + +### As git submodule + Inside the folder of your Hugo project, run: ```bash @@ -80,7 +106,7 @@ Open `config.toml` or `hugo.toml`, change `theme` to `"paper"`: theme = "paper" ``` -For more information, please read the [official guide](https://gohugo.io/getting-started/quick-start/#step-3-add-a-theme) of Hugo. +For more information, please read the [official guide](https://gohugo.io/getting-started/quick-start/#configure-the-site) of Hugo. ## License diff --git a/exampleSite/.hugo_build.lock b/exampleSite/.hugo_build.lock deleted file mode 100644 index e69de29..0000000 diff --git a/exampleSite/README.md b/exampleSite/README.md index 11a456c..982c9f7 100644 --- a/exampleSite/README.md +++ b/exampleSite/README.md @@ -26,4 +26,4 @@ hugo server -t YOURTHEME - 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/content/post/math-typesetting.md b/exampleSite/content/post/math-typesetting.md index a71637e..2d0ec48 100644 --- a/exampleSite/content/post/math-typesetting.md +++ b/exampleSite/content/post/math-typesetting.md @@ -22,8 +22,8 @@ In this example we will be using [KaTeX](https://katex.org/) {{ 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) diff --git a/exampleSite/config.toml b/exampleSite/hugo.toml similarity index 100% rename from exampleSite/config.toml rename to exampleSite/hugo.toml diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..efab603 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/nanxiaobei/hugo-paper + +go 1.20