URL building change dependin of the page

Hello,
I’m all new with Hugo and need some help ('m probably missing Something big but can’t see what).

To give ou a bit of context, I’ve been using Hugo with gitlab.io pages to build a small website (https://wovalab.gitlab.io/open-source/asciidoc-toolkit/) to gather information about an open source project. Source code can be find here on the website

My issue is the Following. I wrote a post with two links in it (one picture and one file) that lead to resources stored in static folder.

On the root page links are correctly formated but if I click the Read more link to dispay the post,the post name is added to the url

I try different confiuration without success and finaly came to fix the issue using absolute url

It doesn’t sound really satisfiying for me and I’ll will be happy to know what I’m doing wrong.

Thank you in advance for your help and your time.

Olivier

Note that I removed some code exampleto comply with rules that limit number of url in a beginner to 2… If you need more info just let me know, I’ll put them on a reply

Hi,

Can you give an example of how you are forming the links?

Hello pointyfar,

Links are formated like this in 2019-11-3-first-public-release.md:

![Asciidoc for LabVIEW functions palette](img/v1.0.0-function-palette.png)

[Asciidoc toolkit for LabVIEW v1.0.0](vip/wovalab_lib_asciidoc_for_labview-1.0.0.11.vip)

This is “interpreted” as (for the second ling for example):

On the main page: http://localhost:1313/open-source/asciidoc-toolkit/vip/wovalab_lib_asciidoc_for_labview-1.0.0.11.vip <-- corect

On the post page: http://localhost:1313/open-source/asciidoc-toolkit/post/2019-11-3-first-public-release/vip/wovalab_lib_asciidoc_for_labview-1.0.0.11.vip

If you put /vip (forward slash first), it works everywhere, ne?

Sadly no :frowning:

You ought to link to the repo for this; I poked around your GitLab account and can’t find it.

I need something to play with, because I don’t link like that very often (no particular reason, just usage), but I think there is a way to make it do what you want. :slight_smile:

You can find code in www folder —> https://gitlab.com/wovalab/open-source/asciidoc-toolkit/tree/develop/www

Thanks,

Olivier

Hello,
Just to know if someone have an idea to solve my issue.

Thanks in advance.

sounds a bit like my issue, where split occasionally renders differently, but in your case it’s consistent, so congraulations

@odjau, in your config you have relativeURLs = false. When I set it to true, the follow is produced:

2019-11-3-first-public-release.md (I modify the URL):

### Download
[Asciidoc toolkit for LabVIEW v1.0.0](/vip/wovalab_lib_asciidoc_for_labview-1.0.0.11.vip)

http://localhost:1313/open-source/asciidoc-toolkit/:

<h3 id="download">Download</h3>

<p><a href="./vip/wovalab_lib_asciidoc_for_labview-1.0.0.11.vip">Asciidoc toolkit for LabVIEW v1.0.0</a></p>

http://localhost:1313/open-source/asciidoc-toolkit/post/2019-11-3-first-public-release/:

<h3 id="download">Download</h3>

<p><a href="../../vip/wovalab_lib_asciidoc_for_labview-1.0.0.11.vip">Asciidoc toolkit for LabVIEW v1.0.0</a></p>

From the user perspective, the URL for the link is http://localhost:1313/open-source/asciidoc-toolkit/vip/wovalab_lib_asciidoc_for_labview-1.0.0.11.vip, as I would expect.

Please see https://gohugo.io/content-management/urls/#relative-urls for reference.

If you require relativeURLs be false, I think you’ll need to change your approach.

This works when I test it. I changed the file content/post/2019-11-3-first-public-release.md to look like this.

We are happy to release the first public version of the tookit.

![Asciidoc for LabVIEW functions palette](/img/v1.0.0-function-palette.png)

### Download
[Asciidoc toolkit for LabVIEW v1.0.0](/vip/wovalab_lib_asciidoc_for_labview-1.0.0.11.vip)

The relativeURLs are set to false by default and I have not had a need to change that on any of the sites I have built.

Without the leading forward slash in the url a web server will interpret the url as relative of the current directory. This is how it’s supposed to work.

With the leading forward slash in the url it will be relative to the root of the site. This is almost always what you want. It makes it possible to move the content around and all the links will continue to work.

This is also nothing specific to Hugo, it works like this on every HTML page in existence.