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 index.md.
where the index.md 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.
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.
See the files content/index.md and public/index.html. The result of {{< ref "index.md" >}} 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 /.
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/_index.md.
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.
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”?
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.