Skip to content

Commit b02b0be

Browse files
authored
Hugo workspace supporting use of local Docsy (#194)
1 parent c608813 commit b02b0be

7 files changed

+44
-21
lines changed

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,40 @@ docker-compose rm
102102
```
103103
For more information see the [Docker Compose documentation][].
104104

105+
## Using a local Docsy clone
106+
107+
Make sure your installed go version is `1.18` or higher.
108+
109+
Clone the latest version of the docsy theme into the parent folder of your project. The newly created repo should now reside in a sibling folder of your site's root folder.
110+
111+
```shell
112+
cd root-of-your-site
113+
git clone --branch v0.7.2 https://github.com/google/docsy.git ../docsy
114+
```
115+
116+
Now run:
117+
118+
```shell
119+
HUGO_MODULE_WORKSPACE=docsy.work hugo server --ignoreVendorPaths "**"
120+
```
121+
122+
or, when using npm, prepend `local` to the script you want to invoke, e.g.:
123+
124+
```shell
125+
npm run local serve
126+
```
127+
128+
By using the `HUGO_MODULE_WORKSPACE` directive (either directly or via prefix `local` when using npm), the server now watches all files and directories inside the sibling directory `../docsy` , too. Any changes inside the local `docsy` theme clone are now immediately picked up (hot reload), you can instantly see the effect of your local edits.
129+
130+
In the command above, we used the environment variable `HUGO_MODULE_WORKSPACE` to tell hugo about the local workspace file `docsy.work`. Alternatively, you can declare the workspace file inside your settings file `hugo.toml`:
131+
132+
```toml
133+
[module]
134+
workspace = "docsy.work"
135+
```
136+
137+
Your project's `hugo.toml` file already contains these lines, the directive for workspace assignment is commented out, however. Remove the two trailing comment characters '//' so that this line takes effect.
138+
105139
## Troubleshooting
106140

107141
As you run the website locally, you may run into the following error:

docsy.work

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
go 1.19
2+
3+
use .
4+
use ../docsy/ // Local docsy clone resides in sibling folder to this project
5+
// use ./themes/docsy/ // Local docsy clone resides in themes folder

docsy.work.sum

Whitespace-only changes.

go.sum

-18
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
1-
github.com/FortAwesome/Font-Awesome v0.0.0-20220831210243-d3a7818c253f h1:bvkUptSRPZBr3Kxuk+bnWCEmQ5MtEJX5fjezyV0bC3g=
2-
github.com/FortAwesome/Font-Awesome v0.0.0-20220831210243-d3a7818c253f/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
3-
github.com/FortAwesome/Font-Awesome v0.0.0-20221115183454-96cafbd73ec4 h1:xfr9SidRCMEh4A8fdkLhFPcHAVbrdv3Ua0Jp/nSmhhQ=
4-
github.com/FortAwesome/Font-Awesome v0.0.0-20221115183454-96cafbd73ec4/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
51
github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2 h1:Uv1z5EqCfmiK4IHUwT0m3h/u/WCk+kpRfxvAZhpC7Gc=
62
github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
7-
github.com/google/docsy v0.5.1 h1:D/ZdFKiE29xM/gwPwQzmkyXhcbQGkReRS6aGrF7lnYk=
8-
github.com/google/docsy v0.5.1/go.mod h1:maoUAQU5H/d+FrZIB4xg1EVWAx7RyFMGSDJyWghm31E=
9-
github.com/google/docsy v0.6.0 h1:43bVF18t2JihAamelQjjGzx1vO2ljCilVrBgetCA8oI=
10-
github.com/google/docsy v0.6.0/go.mod h1:VKKLqD8PQ7AglJc98yBorATfW7GrNVsn0kGXVYF6G+M=
11-
github.com/google/docsy v0.7.0 h1:JaeZ0/KufX/BJ3SyATb/fmZa1DFI7o5d9KU+i6+lLJY=
12-
github.com/google/docsy v0.7.0/go.mod h1:5WhIFchr5BfH6agjcInhpLRz7U7map0bcmKSpcrg6BE=
13-
github.com/google/docsy v0.7.1 h1:DUriA7Nr3lJjNi9Ulev1SfiG1sUYmvyDeU4nTp7uDxY=
14-
github.com/google/docsy v0.7.1/go.mod h1:JCmE+c+izhE0Rvzv3y+AzHhz1KdwlA9Oj5YBMklJcfc=
153
github.com/google/docsy v0.7.2 h1:KzhFgTd3taF1jq9HDemH3omlUqn9qfdE68sxRyTySpM=
164
github.com/google/docsy v0.7.2/go.mod h1:ol3w2s1FBUzENdKSAEeNjtuaISUzHYHTw60xv5QH3Dg=
17-
github.com/google/docsy/dependencies v0.5.1/go.mod h1:EDGc2znMbGUw0RW5kWwy2oGgLt0iVXBmoq4UOqstuNE=
18-
github.com/google/docsy/dependencies v0.6.0/go.mod h1:EDGc2znMbGUw0RW5kWwy2oGgLt0iVXBmoq4UOqstuNE=
19-
github.com/google/docsy/dependencies v0.7.0/go.mod h1:gihhs5gmgeO+wuoay4FwOzob+jYJVyQbNaQOh788lD4=
20-
github.com/google/docsy/dependencies v0.7.1/go.mod h1:gihhs5gmgeO+wuoay4FwOzob+jYJVyQbNaQOh788lD4=
215
github.com/google/docsy/dependencies v0.7.2 h1:+t5ufoADQAj4XneFphz4A+UU0ICAxmNaRHVWtMYXPSI=
226
github.com/google/docsy/dependencies v0.7.2/go.mod h1:gihhs5gmgeO+wuoay4FwOzob+jYJVyQbNaQOh788lD4=
23-
github.com/twbs/bootstrap v4.6.2+incompatible h1:TDa+R51BTiy1wEHSYjmqDb8LxNl/zaEjAOpRE9Hwh/o=
24-
github.com/twbs/bootstrap v4.6.2+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
257
github.com/twbs/bootstrap v5.2.3+incompatible h1:lOmsJx587qfF7/gE7Vv4FxEofegyJlEACeVV+Mt7cgc=
268
github.com/twbs/bootstrap v5.2.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=

hugo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ enable = false
217217
# hugo module configuration
218218

219219
[module]
220-
# uncomment line below for temporary local development of module
221-
# replacements = "github.com/google/docsy -> ../../docsy"
220+
# Uncomment the next line to build and serve using local docsy clone declared in the named Hugo workspace:
221+
# workspace = "docsy.work"
222222
[module.hugoVersion]
223223
extended = true
224224
min = "0.110.0"

netlify.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ command = "npm run build:preview"
66
publish = "public"
77

88
[build.environment]
9-
GO_VERSION = "1.20.5"
9+
GO_VERSION = "1.21.4"
1010

1111
[context.production]
1212
command = "npm run build:production"

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
"_check:links": "echo IMPLEMENTATION PENDING for check-links; echo",
1414
"_hugo": "hugo --cleanDestinationDir",
1515
"_hugo-dev": "npm run _hugo -- -e dev -DFE",
16+
"_local": "cross-env HUGO_MODULE_WORKSPACE=docsy.work",
1617
"_serve": "npm run _hugo-dev -- --minify serve",
1718
"build:preview": "npm run _hugo-dev -- --minify --baseURL \"${DEPLOY_PRIME_URL:-/}\"",
1819
"build:production": "npm run _hugo -- --minify",
1920
"build": "npm run _build -- ",
2021
"check:links:all": "HTMLTEST_ARGS= npm run _check:links",
2122
"check:links": "npm run _check:links",
2223
"clean": "rm -Rf public/* resources",
24+
"local": "npm run _local -- npm run",
2325
"make:public": "git init -b main public",
2426
"precheck:links:all": "npm run build",
2527
"precheck:links": "npm run build",

0 commit comments

Comments
 (0)