From fcbc65c81ceb7ff31879e997026d79e5215f7b90 Mon Sep 17 00:00:00 2001
From: Andreas Deininger <andreas@deininger.net>
Date: Fri, 14 Jan 2022 11:11:02 +0000
Subject: [PATCH] feat: turn anatole theme into a hugo module (#291)

---
 exampleSite/go.mod                      |    3 +++
 go.mod                                  |    3 +++
 exampleSite/config/_default/config.toml |    5 +++++
 README.md                               |   34 +++++++++++++++++++++++++++++++---
 4 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 3fac9f1..f9235d2 100644
--- a/README.md
+++ b/README.md
@@ -52,13 +52,41 @@
 
 ## Quick Start
 
+### Route 1 (recommended): use theme as Hugo module
+
+1. Install prerequisites [git](https://git-scm.com/downloads) and [go](https://go.dev/dl/) (>= 1.12)
+2. Turn your Hugo Project into a Hugo module: `hugo mod init github.com/me/my-project`
+3. Declare the `Anatole` module as a dependency of your site: `hugo mod get github.com/lxndrblz/anatole`
+4. Add the following lines at the end of your `config.toml`:
+
+```
+[module]
+  # uncomment line below for temporary local development of module
+  # replacements = "github.com/lxndrblz/anatole -> ../../anatole"
+  [[module.imports]]
+    path = "github.com/lxndrblz/anatole"
+    disable = false
+```
+### Route 2 (traditional): install theme as Git submodule
+
 1. Add the repository into your Hugo Project repository as a submodule: `git submodule add https://github.com/lxndrblz/anatole.git themes/anatole`.
-2. Configure your `config.toml`. Feel free to copy the demo `config.toml` and some content from the exampleSite.
-3. Build your site with `hugo serve` and admire the result at `http://localhost:1313/`.
+
+### Start up your site
+
+1. Configure your `config.toml`. Feel free to copy the demo `config.toml` and some content from the exampleSite.
+2. Build your site with `hugo serve` and admire the result at `http://localhost:1313/`.
 
 ## Update your installation
 
-If you want to get the latest update of the `Anatole` theme, please execute this command:
+If you want to get the latest update of the `Anatole` theme, please follow the instructions below:
+
+### Theme as Hugo module
+
+```shell
+hugo mod get -u github.com/lxndrblz/anatole
+```
+
+### Theme as Git submodule
 
 ```shell
 git submodule update --remote --merge
diff --git a/exampleSite/config/_default/config.toml b/exampleSite/config/_default/config.toml
index c404a21..1fd66e6 100644
--- a/exampleSite/config/_default/config.toml
+++ b/exampleSite/config/_default/config.toml
@@ -2,7 +2,12 @@
 languageCode = "en"
 DefaultContentLanguage = "en"
 title = "Website of Jane Doe"
+
+# theme as hugo module
+#theme = "github.com/lxndrblz/anatole"
+# theme as git submodule
 theme = "anatole"
+
 summarylength = 10
 enableEmoji = true
 enableRobotsTXT = true
diff --git a/exampleSite/go.mod b/exampleSite/go.mod
new file mode 100644
index 0000000..8848608
--- /dev/null
+++ b/exampleSite/go.mod
@@ -0,0 +1,3 @@
+module github.com/lxndrblz/anatole-example
+
+go 1.12
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..c42fd6c
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,3 @@
+module github.com/lxndrblz/anatole
+
+go 1.12

--
Gitblit v1.10.0