# Set Site.Params from the command line

**URL:** <https://discourse.gohugo.io/t/set-site-params-from-the-command-line/11100>\
**Category:** support\
**Created:** [March 19, 2018, 12:08pm UTC](https://discourse.gohugo.io/t/set-site-params-from-the-command-line/11100 "2018-03-19T12:08:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![frischefarbe](https://avatars.discourse-cdn.com/v4/letter/f/e47c2d/32.png) [@frischefarbe](https://discourse.gohugo.io/u/frischefarbe)\
**Post date:** [March 19, 2018, 12:08pm UTC](https://discourse.gohugo.io/t/set-site-params-from-the-command-line/11100/1 "2018-03-19T12:08:20Z")

</div>

I’d like to know if it is possible to set a `Site.Params` value from the command line.

The reason: I have a version number for my software which I would like to include into the hugo generated documentation (see [https://doc.speedata.de/publisher/de/](https://doc.speedata.de/publisher/de/) at the top).

If it is not possible to set a value for `Site.Params`: is there an alternative approach? I have tried to override the parameter with an environment variable, but I ran into the same issues as discussed in [How to access config [params] map from command line](https://discourse.gohugo.io/t/how-to-access-config-params-map-from-command-line/6505).

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [March 19, 2018, 12:24pm UTC](https://discourse.gohugo.io/t/set-site-params-from-the-command-line/11100/2 "2018-03-19T12:24:38Z")

</div>

> [@frischefarbe](#):
>
> is there an alternative approach?

I just use `sed` (on GNU/Linux, Mac and \*nix systems).

If you have this in `config.toml`:

```toml
[params]
foo = 1

```

And you want to change the `foo` variable, do:

```auto
sed -i.bkp 's/foo =.*/foo = "NEW VAL"/' config.toml

```

_`sed` and such are a lost art worth learning even for web dev._

---

<div class="post-metadata">

**Author:** ![frischefarbe](https://avatars.discourse-cdn.com/v4/letter/f/e47c2d/32.png) [@frischefarbe](https://discourse.gohugo.io/u/frischefarbe)\
**Post date:** [March 19, 2018, 12:35pm UTC](https://discourse.gohugo.io/t/set-site-params-from-the-command-line/11100/3 "2018-03-19T12:35:59Z")

</div>

Thanks, @kaushalmodi

the sed approach has the side effect that the file changes from the version control’s view (although there are mechanisms to ignore the change etc.)

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [March 19, 2018, 12:52pm UTC](https://discourse.gohugo.io/t/set-site-params-from-the-command-line/11100/4 "2018-03-19T12:52:17Z")

</div>

> [@frischefarbe](#):
>
> the side effect that the file changes from the version control’s view

I’d actually do that on the CI/CD itself, e.g. Netlify `command` parameter.

You can also choose to do that AND have multiple config files:

> **[Configure Hugo](https://gohugo.io/getting-started/configuration/)**
>
> How to configure your Hugo site.

… keep a main config file that you version control, and another that you don’t, that you create/modify on the fly (You would do the same on CI/CD too; the benefit being that you don’t need to alter-then-restore the main config file before committing.)
