1
0
Fork 0

Offer theme as hugo module

This commit is contained in:
Andreas Deininger 2023-08-14 22:11:17 +02:00
parent f8eba3b591
commit 4dd01ec2c4
6 changed files with 35 additions and 6 deletions

View file

@ -56,18 +56,44 @@ disqusShortname = 'YOUR_DISQUS_SHORTNAME' # use disqus comments
monoDarkIcon = true # show monochrome dark mode icon monoDarkIcon = true # show monochrome dark mode icon
gravatarCdn = 'GRAVATAR_CDN_LINK' # e.g. 'https://cdn.v2ex.com/gravatar/' gravatarCdn = 'GRAVATAR_CDN_LINK' # e.g. 'https://cdn.v2ex.com/gravatar/'
graphCommentId = "YOUR_GRAPH_COMMENT_ID" # use graph comment (disqus alternative) 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: Available options to front matter:
```toml ```toml
comments = false # disable comments for a specific page 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 ## Install
### As hugo module
Inside the folder of your Hugo project, run:
```bash
hugo mod init github.com/<USERNAME>/<REPONAME>
```
Add paper theme ad dependency of your site:
```bash
hugo mod init github.com/<USERNAME>/<REPONAME>
```
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: Inside the folder of your Hugo project, run:
```bash ```bash
@ -80,7 +106,7 @@ Open `config.toml` or `hugo.toml`, change `theme` to `"paper"`:
theme = "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 ## License

View file

@ -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) - 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 - 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

View file

@ -22,8 +22,8 @@ In this example we will be using [KaTeX](https://katex.org/)
{{ end }} {{ end }}
``` ```
- To enable KaTex globally set the parameter `math` to `true` in a project's configuration - 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 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) **Note:** Use the online reference of [Supported TeX Functions](https://katex.org/docs/supported.html)

3
go.mod Normal file
View file

@ -0,0 +1,3 @@
module github.com/nanxiaobei/hugo-paper
go 1.20