# Symlinks and duplicate content w/ different paths

**URL:** <https://discourse.gohugo.io/t/symlinks-and-duplicate-content-w-different-paths/10754>\
**Category:** support\
**Created:** [February 27, 2018, 12:37am UTC](https://discourse.gohugo.io/t/symlinks-and-duplicate-content-w-different-paths/10754 "2018-02-27T00:37:18Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![grepory](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grepory/32/5347_2.png) [@grepory](https://discourse.gohugo.io/u/grepory)\
**Post date:** [February 27, 2018, 12:37am UTC](https://discourse.gohugo.io/t/symlinks-and-duplicate-content-w-different-paths/10754/1 "2018-02-27T00:37:18Z")

</div>

We have versioned documentation and we’re trying to alias content via symlinks–which we have “working,” but not without errors when running hugo, e.g.:

```
ERROR 2018/02/26 16:34:07 Two or more menu items have the same name/identifier in Menu "sensu-core-1.2": "CHANGELOG".
Rename or set an unique identifier.

```

The URLs behave appropriately (/2.8 and /latest both work and point to the same content), but these errors cause hugo to exit non-zero–appropriately, I suppose.

So I have a couple of questions:

Is it intended for this to work? (I think the answer is no, and that it just happens to work.)  
Are we doing it wrong?

I know we can do this with aliases, but then we have to maintain frontmatter for every page that should be “latest.” Or am I missing some other mechanism for aliasing.

Any suggestions would be super helpful.

---

<div class="post-metadata">

**Author:** ![brunoamaral](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/brunoamaral/32/21144_2.png) [@brunoamaral](https://discourse.gohugo.io/u/brunoamaral)\
**Post date:** [February 27, 2018, 10:57am UTC](https://discourse.gohugo.io/t/symlinks-and-duplicate-content-w-different-paths/10754/2 "2018-02-27T10:57:22Z")

</div>

How are you doing this in the frontmatter? Seems to be you could get this behaviour using something like this:

```auto
aliases: ["/latest","/2.8"]

```

---

<div class="post-metadata">

**Author:** ![grepory](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grepory/32/5347_2.png) [@grepory](https://discourse.gohugo.io/u/grepory)\
**Post date:** [February 27, 2018, 4:46pm UTC](https://discourse.gohugo.io/t/symlinks-and-duplicate-content-w-different-paths/10754/3 "2018-02-27T16:46:05Z")

</div>

We aren’t doing anything in frontmatter right now. We’re actually trying to figure out how to avoid that. If we do this in frontmatter, we’d have to automate the process, because otherwise we’d have quite a few files’ frontmatter to edit when we release a new version of the documentation.

---

<div class="post-metadata">

**Author:** ![grepory](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grepory/32/5347_2.png) [@grepory](https://discourse.gohugo.io/u/grepory)\
**Post date:** [February 27, 2018, 5:25pm UTC](https://discourse.gohugo.io/t/symlinks-and-duplicate-content-w-different-paths/10754/4 "2018-02-27T17:25:55Z")

</div>

Also, to clarify, what we’re currently doing is literally symlinking the latest -\> 2.8

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [February 27, 2018, 5:43pm UTC](https://discourse.gohugo.io/t/symlinks-and-duplicate-content-w-different-paths/10754/6 "2018-02-27T17:43:18Z")

</div>

The problem is that the two versions of the same page will be assigned the same ID in the defined menu. Removing the ERROR message will not fix the problem with the menu. The menu logic needs to be adjusted for this case. The menu code is not mine, but you need to create a GH issue to track this.

---

<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:** [February 27, 2018, 5:45pm UTC](https://discourse.gohugo.io/t/symlinks-and-duplicate-content-w-different-paths/10754/7 "2018-02-27T17:45:49Z")

</div>

@grepory Wouldn’t simply setting redirects work?

Redirect all /latest/\* pages to /2.8/\*… Then you need to update just that one redirect file on each version update. You don’t even need symlinks.

---

<div class="post-metadata">

**Author:** ![grepory](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grepory/32/5347_2.png) [@grepory](https://discourse.gohugo.io/u/grepory)\
**Post date:** [February 27, 2018, 5:51pm UTC](https://discourse.gohugo.io/t/symlinks-and-duplicate-content-w-different-paths/10754/8 "2018-02-27T17:51:02Z")

</div>

Is there a concept of redirects in hugo?

---

<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:** [February 27, 2018, 6:02pm UTC](https://discourse.gohugo.io/t/symlinks-and-duplicate-content-w-different-paths/10754/9 "2018-02-27T18:02:52Z")

</div>

No, it depends on where you deploy your site.

Here’s an [example Netlify redirect file](https://github.com/kaushalmodi/ox-hugo/blob/master/doc/static/_redirects); it redirects [http://ox-hugo.scripter.co/test/](http://ox-hugo.scripter.co/test/) to [https://ox-hugo-tests.netlify.com/](https://ox-hugo-tests.netlify.com/) **while retaining the URL prefix** (So while the URL shows `https://ox-hugo.scripter.co/test/posts/no-toc-in-summary--without-more/`, it’s actually loading `https://ox-hugo-tests.netlify.com/posts/no-toc-in-summary--without-more/`).

I mention this example because it might apply to your use case too (_show URL with `/latest/` in path, but actually load pages from `/2.8/`?_).

_I am not a web developer, so forgive me if I am stating the obvious._

If you are using Netlify, its [Redirect & Rewrite rules](https://www.netlify.com/docs/redirects/) article would help.

* * *

**Update** : _Add info about empty `_index.md` file._

I also need an empty `_index.md` for the `test/` section so that Hugo generates a valid page for that.

### `content/test/_index.md`

```auto
+++
title = "Test Site"
+++

```

---

<div class="post-metadata">

**Author:** ![grepory](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grepory/32/5347_2.png) [@grepory](https://discourse.gohugo.io/u/grepory)\
**Post date:** [February 27, 2018, 6:07pm UTC](https://discourse.gohugo.io/t/symlinks-and-duplicate-content-w-different-paths/10754/10 "2018-02-27T18:07:44Z")

</div>

Ahhhhh okay, right. Yeah, my suspicion was that we were going to have to do URL rewriting/redirects somehow, but Heroku doesn’t support it. I had forgotten about netlify, though. Will ponder how we might be able to do this. Thanks.

---

<div class="post-metadata">

**Author:** ![grepory](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grepory/32/5347_2.png) [@grepory](https://discourse.gohugo.io/u/grepory)\
**Post date:** [February 27, 2018, 7:05pm UTC](https://discourse.gohugo.io/t/symlinks-and-duplicate-content-w-different-paths/10754/11 "2018-02-27T19:05:28Z")

</div>

Also, it appears that if we just use the static buildpack in heroku, then we can do this there as well:

> **[heroku/heroku-buildpack-static](https://github.com/heroku/heroku-buildpack-static#custom-routes)**
>
> Heroku buildpack for handling static sites and single page web apps - heroku/heroku-buildpack-static
