# Best practices for theme development & Hugo Modules

**URL:** <https://discourse.gohugo.io/t/best-practices-for-theme-development-hugo-modules/30568>\
**Category:** Using Themes\
**Created:** [January 11, 2021, 3:12pm UTC](https://discourse.gohugo.io/t/best-practices-for-theme-development-hugo-modules/30568 "2021-01-11T15:12:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cdichiara](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cdichiara/32/13266_2.png) [@cdichiara](https://discourse.gohugo.io/u/cdichiara)\
**Post date:** [January 11, 2021, 3:12pm UTC](https://discourse.gohugo.io/t/best-practices-for-theme-development-hugo-modules/30568/1 "2021-01-11T15:12:22Z")

</div>

Hi,

So this is sort of a combination question:

1. I’m having some difficulty working on a theme when my website is using the theme via a hugo module. I push a change to my public forked repository, which I have replaced as the hugo module in my `config.toml`:

```auto
# path = "github.com/lxndrblz/anatole"
    path = "github.com/cdichiara/anatole"

```

I’m not seeing changes reflected. Is there some command to re-initialize the hugo modules that I forgot to run?

1. What is the best practices that people are doing when they’re working on a theme? Should I create a dummy website and have github mount the theme in the `/themes/` directory in order to make changes without pushing?

Thanks in advance,

Carmine

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [January 11, 2021, 3:49pm UTC](https://discourse.gohugo.io/t/best-practices-for-theme-development-hugo-modules/30568/2 "2021-01-11T15:49:25Z")

</div>

> [@cdichiara](#):
>
> 1. What is the best practices that people are doing when they’re working on a theme?

Theme overrides are the way to go for third party themes, so that the original can be updated.  
The overrides go under `/project-root/layouts/` you need to replicate the PATH of the theme template you wish to customize.

> [@cdichiara](#):
>
> Is there some command to re-initialize the hugo modules that I forgot to run?

See: [hugo mod get | Hugo](https://gohugo.io/commands/hugo_mod_get/#readout)

---

<div class="post-metadata">

**Author:** ![cdichiara](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cdichiara/32/13266_2.png) [@cdichiara](https://discourse.gohugo.io/u/cdichiara)\
**Post date:** [January 11, 2021, 4:01pm UTC](https://discourse.gohugo.io/t/best-practices-for-theme-development-hugo-modules/30568/3 "2021-01-11T16:01:33Z")

</div>

> [@alexandros](#):
>
> Theme overrides are the way to go for third party themes, so that the original can be updated.  
> The overrides go under `/project-root/layouts/` you need to replicate the PATH of the theme template you wish to customize.

Ah thank you again @alexandros … so I’m helping develop the theme, not just overriding it for this one website. That’s why I forked the theme and am making fixes. I’m trying to figure out if people have best practices for quick updates of themes that are mounted using the Module system, or if they just revert to mounting the theme statically for the duration of development.

> [@alexandros](#):
>
> See: [hugo mod get | Hugo](https://gohugo.io/commands/hugo_mod_get/#readout)

Ah yes … so the interesting thing is, either I ran that command or somehow I picked up my module change anyways … because in `go.mod` I can see the new module being required and in `go.sum` I see the hash. But up to now I haven’t been able to see my changes reflected in the test website. In the end I may just abandon using the modules for development … maybe it’s not worth the challenge and the mandatory pushes.

Thanks,

Carmine

---

<div class="post-metadata">

**Author:** ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)\
**Post date:** [January 12, 2021, 12:20am UTC](https://discourse.gohugo.io/t/best-practices-for-theme-development-hugo-modules/30568/4 "2021-01-12T00:20:48Z")

</div>

For theme dev and testing, I use a `development` config that points to a local module: [Configure Hugo | Hugo](https://gohugo.io/getting-started/configuration/#configuration-directory)

then I have a `production` config that points to the github location.

---

<div class="post-metadata">

**Author:** ![cdichiara](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cdichiara/32/13266_2.png) [@cdichiara](https://discourse.gohugo.io/u/cdichiara)\
**Post date:** [January 12, 2021, 1:48am UTC](https://discourse.gohugo.io/t/best-practices-for-theme-development-hugo-modules/30568/5 "2021-01-12T01:48:52Z")

</div>

Thank you @pointyfar that confirms it, I bit the bullet and mounted the theme as a submodule for dev purposes. I’ll look into separate dev and production configs.

Carmine

---

<div class="post-metadata">

**Author:** ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)\
**Post date:** [January 12, 2021, 2:25am UTC](https://discourse.gohugo.io/t/best-practices-for-theme-development-hugo-modules/30568/6 "2021-01-12T02:25:04Z")

</div>

Just to clarify, something like this is what I meant:

```auto
├── site-foo
│ ├── config
│ │ ├── _default
│ │ ├── development
│ │ └── production
│ └── ...
└── themes
    ├── theme1
    └── theme2

```

```auto
# dev
themesDir = "../../themes"
theme = "theme1"

# prod
theme = "github.com/pointyfar/theme1"

```

I do not use git submodules.

---

<div class="post-metadata">

**Author:** ![cdichiara](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cdichiara/32/13266_2.png) [@cdichiara](https://discourse.gohugo.io/u/cdichiara)\
**Post date:** [January 12, 2021, 3:03am UTC](https://discourse.gohugo.io/t/best-practices-for-theme-development-hugo-modules/30568/7 "2021-01-12T03:03:39Z")

</div>

Ah that’s cool thanks for the diagram I like the approach.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [January 14, 2021, 3:03am UTC](https://discourse.gohugo.io/t/best-practices-for-theme-development-hugo-modules/30568/8 "2021-01-14T03:03:45Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
