Link to -> index.html

I try to create a bunch of HTML files with relative links so that I can serve the files from a local directory without a server.
This works fine except for links to the main file called

This is my config.toml:

languageCode = "en-us"
title = "foo"
theme = "mytheme

relativeURLs = true
canonifyURLs = false
uglyURLs = true
permalinks = ":slug"
pygmentsCodeFences = true
pygmentsStyle = "manni"
pygmentsUseClasses = true

And I try to create a link like this:

{{<ref "" >}}

where the is in the contents directory. The file gets convertet to index.html, but the resulting link of the ref shortcode above is a link to a directory and not to index.html. What should I do to get Hugo to create a link to index.html? All other links look fine to me.

I am using Hugo v0.30.2

I’d appreciate any help on this topic!

Is the issue that visiting the site without a server isn’t showing the appropriate file for that directory? I am trying to understand the issue you are having. :slight_smile:

Hi - please give us a link to your source. See hints here: Requesting Help

The repository with the source code is here:

See the files content/ and public/index.html. The result of {{< ref "" >}} should be index.html and not /. When I try to read the resulting HTML files with a browser from my file system without a server, I cannot link to /.

Hmm, the way you’re doing it is not so regular. Let’s start with a “normal” way of doing it. My site has a pretty typical setup.


If you poke around in there you can see how things are linked together. The main layouts/index.html template uses .Content to pull from its companion content/

It still does create the index.html in the root. I have not tried what you are trying, to get everything to work offline with relative links. It might be an option for you to simply publish it, then pull it down with wget and let wget convert it for local use. But it should also be possible to use the right combination of baseURL and relURL etc to get what you want.

Hmm, the way you’re doing it is not so regular.

Can you tell me what is not regular? I don’t see anything wrong (= in contradiction to the documentation)

Ok, looking at your stuff again, I see it’s just very sparse, but, should work. You’re right, there does not seem to be anything wrong. I though it was missing something because it’s sparse. But the structure seems ok.

As for rel returning a full index.html instead of /, I am not sure, but, maybe you could try “ugly urls”?

Hello Rick,

thanks for your reply. uglyURLs is already set to true, Even setting it to false does not make any change.


Hmm. Just for testing, perhaps try quoting the value in your config? That is, doing "true" instead of true. TOML is supposed to support both, but, maybe try it for consistency.

@RickCogley This doesn’t help either.

I’ll try to ask a new question with a small correction I’ve got from another thread.