Looking for the perfect hugo relative url setting

My webpage runs perfectly in hugo serve. But it breaks in hugo build.

Configuring baseURL ="/" renders this index.html page

<link rel="shortcut icon" href="/images/favicon.png" type="image/x-icon" />
<link href="/css/nucleus.css" rel="stylesheet">
<link href="/css/font-awesome.min.css" rel="stylesheet">
<link href="/css/hybrid.css" rel="stylesheet">
<link href="/css/featherlight.min.css" rel="stylesheet">
<link href="/css/auto-complete.css" rel="stylesheet">
<link href="/theme-original/style.css" rel="stylesheet">

My requirement works perfectly when I modify the rendered index.html as such:

<link rel="shortcut icon" href="/images/favicon.png" type="image/x-icon" />
<link href="css/nucleus.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/hybrid.css" rel="stylesheet">
<link href="css/featherlight.min.css" rel="stylesheet">
<link href="css/auto-complete.css" rel="stylesheet">
<link href="theme-original/style.css" rel="stylesheet">

I don’t know what to change in order to achieve this. Setting baseURL="" seems not to work.

I am aware that changing the partial should fix this but I’m afraid of breaking something I’m not expecting. Is there an easier way?

Problem is: I want an offline documentation

I’ve also read some question/answers like this before asking. I am looking for a solution to make a documentation offline. Obviously, this does not work for me because something like file:///D:/sharedFolder/MISdocumentation/docs/ does not point to index, instead points to file directory. It only renders when I use file:///D:/sharedFolder/MISdocumentation/docs/index.html

Search for relURL and relativeURLs.

This is well documented and discussed before.

1 Like