How to make Hugo working with multiple versions

Hi, I’m trying to implement versioning in hugo documentation site.

I’m faced with the issue of allowing hugo to parse docs of different releases/versions during build. I’m geting error that I have duplicates in my content directories. How can I override this and allow hugo to build duplicate docs?

It’s difficult to guess what’s happening here.

Please post a link to the public repository for your site, and the command you use to build the site.

See:
https://discourse.gohugo.io/t/requesting-help/9132

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Link to repo:

Command I used: Hugo Server

This is the error I’m getting:

ERROR 2020/07/21 18:49:03 "/mnt/c/go-projects/src/github.com/thanos-io/thanos/website/docs-pre-processed/versioned/latest/quick-tutorial.md:1:1": duplicate menu entry with identifier "Quick Tutorial" in menu "thanos"
ERROR 2020/07/21 18:49:03 "/mnt/c/go-projects/src/github.com/thanos-io/thanos/website/docs-pre-processed/versioned/release-0.10/quick-tutorial.md:1:1": duplicate menu entry with identifier "Quick Tutorial" in menu "thanos"

I assume that you have something like this configured in some of your pages:

---
menu: "main"
---

For a single site setup, I don’t know any way to get rid of that error message.

One option, if you don’t use Hugo’s language feature, would be to define the versions as languages, and just mount the content per version/language.

1 Like