From e07eda273b9a7eaa6afe1bbe590ce3b628f0ab5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 27 Feb 2018 11:08:23 +0100 Subject: [PATCH] Add OS env to faq --- content/getting-started/configuration.md | 8 +++++++- content/troubleshooting/faq.md | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/content/getting-started/configuration.md b/content/getting-started/configuration.md index 5249e4fab..a56df295b 100644 --- a/content/getting-started/configuration.md +++ b/content/getting-started/configuration.md @@ -309,7 +309,7 @@ enableemoji: true ``` {{% /note %}} -## Environmental Variables +## Configure with Environment Variables In addition to the 3 config options already mentioned, configuration key-values can be defined through operating system environment variables. @@ -319,10 +319,16 @@ For example, the following command will effectively set a website's title on Uni $ env HUGO_TITLE="Some Title" hugo ``` +This is really useful if you use a service such as Netlify to deploy your site. Look at the Hugo docs [Netlify configuration file](https://github.com/gohugoio/hugoDocs/blob/master/netlify.toml) for an example. + {{% note "Setting Environment Variables" %}} Names must be prefixed with `HUGO_` and the configuration key must be set in uppercase when setting operating system environment variables. {{% /note %}} +{{< todo >}} +Test and document setting params via JSON env var. +{{< /todo >}} + ## Ignore Files When Rendering The following statement inside `./config.toml` will cause Hugo to ignore files ending with `.foo` and `.boo` when rendering: diff --git a/content/troubleshooting/faq.md b/content/troubleshooting/faq.md index a66493cfa..392d7a8df 100644 --- a/content/troubleshooting/faq.md +++ b/content/troubleshooting/faq.md @@ -17,6 +17,10 @@ aliases: [/faq/] **Note:** The answers/solutions presented below are short, and may not be note be enough to solve your problem. Visit [Hugo Discourse](https://discourse.gohugo.io/) and use the search. It that does not help, start a new topic and ask your questions. {{% /note %}} +## Can I set configuration variables via OS environment? + +Yes you can! See [Configure with Environment Variables](/getting-started/configuration/#configure-with-environment-variables). + ## How do I schedule posts? 1. Set `publishDate` in the page [Front Matter](/content-management/front-matter/) to a date in the future. @@ -34,4 +38,3 @@ Also see this Twitter thread: ## Can I use the latest Hugo version on Netlify? Yes you can! Read [this](/hosting-and-deployment/hosting-on-netlify/#configure-hugo-version-in-netlify). -