Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User guide: module definition: add 'proxy' attribute #994

Merged
merged 2 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = "userguide/public"
command = "npm run docs-install && npm run build:preview"

[build.environment]
GO_VERSION = "1.18"
GO_VERSION = "1.18.2"
HUGO_THEME = "repo"

[context.production]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"bootstrap": "^4.6.1"
},
"devDependencies": {
"hugo-extended": "0.96.0"
"hugo-extended": "0.98.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ As the Docsy example site repo is a [template repository](https://github.blog/20
</pre>

Now you can make local edits and test your copied site locally with Hugo.
{{% alert title="Note" color="primary" %}}
Depending on your environment you may need to tweak the [module top level settings](https://github.com/google/docsy-example/blob/1c7f7e300c90cd690ca5be66b43fe58713bb21c9/config.toml#L221-L228) inside your `config.toml` slightly, for example by adding a proxy to use when downloading remote modules.
You can find details of what these configuration settings do in the [Hugo modules documentation](https://gohugo.io/hugo-modules/configuration/#module-config-top-level).
{{% /alert %}}

Once your site is up and running, you can edit your own versions of the site’s source files.

### Preview your site

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ hugo mod init github.com/me/my-new-site
hugo mod get github.com/google/docsy@v0.2.0
cat >> config.toml <<EOL
[module]
proxy = "direct"
[[module.imports]]
path = "github.com/google/docsy"
[[module.imports]]
Expand All @@ -37,6 +38,8 @@ hugo mod init github.com/me/my-new-site
hugo mod get github.com/google/docsy@v0.2.0
(echo [module]^

proxy = "direct"^

[[module.imports]]^

path = "github.com/google/docsy"^
Expand Down Expand Up @@ -91,6 +94,7 @@ Add the settings in the following snippet at the end of your site configuration
{{< tabpane >}}
{{< tab header="config.toml" >}}
[module]
proxy = "direct"
# uncomment line below for temporary local development of module
# replacements = "github.com/google/docsy -> ../../docsy"
[module.hugoVersion]
Expand All @@ -105,6 +109,7 @@ Add the settings in the following snippet at the end of your site configuration
{{< /tab >}}
{{< tab header="config.yaml" >}}
module:
proxy: direct
hugoVersion:
extended: true
min: 0.73.0
Expand All @@ -118,6 +123,7 @@ module:
{{< tab header="config.json" >}}
{
"module": {
"proxy": "direct",
"hugoVersion": {
"extended": true,
"min": "0.73.0"
Expand All @@ -137,6 +143,9 @@ module:
{{< /tab >}}
{{< /tabpane >}}

You can find details of what these configuration settings do in the [Hugo modules documentation](https://gohugo.io/hugo-modules/configuration/#module-config-top-level).
Depending on your environment you may need to tweak them slightly, for example by adding a proxy to use when downloading remote modules.

### Preview your site

To build and preview your site locally:
Expand Down
9 changes: 9 additions & 0 deletions userguide/content/en/docs/Updating/Convert-site-to-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ hugo mod get github.com/google/docsy@v0.2.0
sed -i '/theme = \["docsy"\]/d' config.toml
cat >> config.toml <<EOL
[module]
proxy = "direct"
[[module.imports]]
path = "github.com/google/docsy"
[[module.imports]]
Expand All @@ -33,6 +34,8 @@ findstr /v /c:"theme = [\"docsy\"]" config.toml > config.toml.temp
move /Y config.toml.temp config.toml
(echo [module]^

proxy = "direct"^

[[module.imports]]^

path = "github.com/google/docsy"^
Expand Down Expand Up @@ -90,6 +93,7 @@ Alternatively, you can omit this line altogether and replace it with the setting
{{< tabpane >}}
{{< tab header="config.toml" >}}
[module]
proxy = "direct"
# uncomment line below for temporary local development of module
# replacements = "github.com/google/docsy -> ../../docsy"
[module.hugoVersion]
Expand All @@ -104,6 +108,7 @@ Alternatively, you can omit this line altogether and replace it with the setting
{{< /tab >}}
{{< tab header="config.yaml" >}}
module:
proxy: direct
hugoVersion:
extended: true
min: 0.73.0
Expand All @@ -117,6 +122,7 @@ module:
{{< tab header="config.json" >}}
{
"module": {
"proxy": "direct",
"hugoVersion": {
"extended": true,
"min": "0.73.0"
Expand All @@ -136,6 +142,9 @@ module:
{{< /tab >}}
{{< /tabpane >}}

You can find details of what these configuration settings do in the [Hugo modules documentation](https://gohugo.io/hugo-modules/configuration/#module-config-top-level).
Depending on your environment you may need to tweak them slightly, for example by adding a proxy to use when downloading remote modules.

{{% alert title="Attention" color="warning" %}}
If you have a multi language installation, please make sure that the section `[languages]` inside your `config.toml` is declared before the section `[module]` with the module imports. Otherwise you will run into trouble!
{{% /alert %}}
Expand Down