diff options
author | Andreas Deininger <andreas@deininger.net> | 2022-02-23 15:52:25 +0300 |
---|---|---|
committer | Andreas Deininger <andreas@deininger.net> | 2022-02-23 15:59:21 +0300 |
commit | 4728f3064e62499bfd099584fa94a8a426d24481 (patch) | |
tree | 403ddeca7202eecab98f6f8e93d0674346be335d | |
parent | 79b96f2486e6fe368ca20316ef5eeccc4d6471fe (diff) |
Turn theme into a hugo module
-rw-r--r-- | README.md | 41 | ||||
-rw-r--r-- | exampleSite/.gitignore | 1 | ||||
-rwxr-xr-x | exampleSite/config.toml | 3 | ||||
-rw-r--r-- | exampleSite/go.mod | 5 | ||||
-rw-r--r-- | exampleSite/go.sum | 2 | ||||
-rw-r--r-- | go.mod | 3 |
6 files changed, 53 insertions, 2 deletions
@@ -30,6 +30,8 @@ Focused on content and typography, the stylized index page is really just a list ## Requirements
+### General
+
Requires the **extended** version of Hugo. You can find [installation instructions here](https://gohugo.io/getting-started/installing/) (latest version recommended). Here's a handy [Bash function for downloading a specific Hugo version](https://victoria.dev/blog/how-to-do-twice-as-much-with-half-the-keystrokes-using-.bashrc/#bash-function-for-downloading-extended-hugo).
Extended Hugo's [PostCSS](https://gohugo.io/hugo-pipes/postcss/) requires JavaScript packages to compile the styles for this theme. If you're seeing an error like this:
@@ -53,8 +55,28 @@ cd exampleSite/ npm i postcss postcss-cli autoprefixer
```
+### Only when using theme as hugo module:
+
+Go language needs to be installed (version >= 1.12), download Go installer [here](https://go.dev/dl/)
+
## 1. Get the theme
+### Route 1 (recommended): use theme as hugo module
+
+Turn your new or existing site into a hugo module by issuing this command from site root:
+
+```sh
+hugo mod init github.com/me/my-sam-based-site
+```
+
+- Declare the `sam` theme module as a dependency of your site:
+
+```
+hugo mod get github.com/victoriadrake/hugo-theme-sam
+```
+
+### Route 2 (traditional): install theme locally (git clone or submodule)
+
Run from the root of your Hugo site:
```sh
@@ -69,7 +91,24 @@ git submodule add https://github.com/victoriadrake/hugo-theme-sam.git themes/sam ### 2. Configure your site
-From the exampleSite, copy `config.toml` to the root folder of your Hugo site and change the fields as you like. There are helpful hints in the file.
+From the exampleSite, copy `config.toml` to the root folder of your Hugo site. Inside this file, identify the `theme = ...` line.
+
+### Route 1 (hugo module)
+
+Make sure the following line is uncommented in order to activate your theme as hugo module:
+
+```
+theme = "github.com/victoriadrake/hugo-theme-sam"
+```
+### Route 2 (theme cloned locally)
+
+Make sure the following line is uncommented in order to activate your theme as hugo module:
+
+```
+theme = "sam"
+```
+
+Afterwards, adapt the configuration parameters inside `config.toml` as you like. There are helpful hints in the file.
### 3. Create pages
diff --git a/exampleSite/.gitignore b/exampleSite/.gitignore new file mode 100644 index 0000000..2149814 --- /dev/null +++ b/exampleSite/.gitignore @@ -0,0 +1 @@ +.hugo_build.lock
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index f55b5e8..78654d5 100755 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -3,7 +3,8 @@ languageCode = "en-us" defaultContentLanguage = "en" isMultilingual = false title = "Call me Sam" -theme = "sam" +theme = "github.com/victoriadrake/hugo-theme-sam" # pull in theme as hugo module +# theme = "sam" # install theme locally (git clone or submodule) pygmentsStyle = "monokai" # https://help.farbox.com/pygments.html pygmentsCodefences = true # googleAnalytics = "" # Tracking code, eg. "UA-111111111-1" diff --git a/exampleSite/go.mod b/exampleSite/go.mod new file mode 100644 index 0000000..4a78f21 --- /dev/null +++ b/exampleSite/go.mod @@ -0,0 +1,5 @@ +module github.com/victoriadrake/hugo-theme-sam/exampleSite + +go 1.12 + +require github.com/victoriadrake/hugo-theme-sam v4.0.2+incompatible // indirect diff --git a/exampleSite/go.sum b/exampleSite/go.sum new file mode 100644 index 0000000..b7e373b --- /dev/null +++ b/exampleSite/go.sum @@ -0,0 +1,2 @@ +github.com/victoriadrake/hugo-theme-sam v4.0.2+incompatible h1:dGd52IdwinWW8EK+Lq8zUrTrHZefF4FJjjX977XxdE0= +github.com/victoriadrake/hugo-theme-sam v4.0.2+incompatible/go.mod h1:JJt8S2FbZpLY5upNn1OfaGbKDkyJJpSAVLpLm8PrDdQ= @@ -0,0 +1,3 @@ +module github.com/victoriadrake/hugo-theme-sam + +go 1.12 |