Bad rendering of the local index.html from public folder using HUGO
Asked Answered
C

3

6

I am creating a web using RStudio and HUGO, by means of the Blogdown package.

When serving the site locally in RStudio, it seems to be rendered properly. All the files are created within the folder /public.

enter image description here

However, when I open the file index.html from the /public folder, I get this appearance.

enter image description here

I am employing the theme Mainroad with this base URL:

baseurl = "/"

Any idea why when opening the HTML file it is not rendered properly?

Craze answered 3/3, 2019 at 18:58 Comment(0)
C
6

Thanks to the HUGO forum, I post the answer that worked for me, just in case somebody get here.

It is pretty simple, just by adding two lines at the top of the config.toml file:

relativeURLs = true
uglyURLs = true
Craze answered 4/3, 2019 at 9:17 Comment(2)
Hi all, I acually added these 2 lines of code. but still the same page (2nd Image of the question)Wein
It is probably because the css is not loaded correctly, check that the link to the css files are starting with https:Cyanocobalamin
C
1

Open the html file in a text editor and check the exact links given for the stylesheets. More than likely, it is not resolvable by the web-browser because it starts with a / and so looks like an absolute path.

When viewed via the microserver packaged with hugo, that would be seen as relative to the server. But when view via a file url, it is seen as an absolute path.

Calculation answered 4/3, 2019 at 0:58 Comment(0)
V
0

Blogdown has released an updated version on CRAN that may address this issue. See this link for discussion: https://github.com/rstudio/blogdown/issues/372

Valletta answered 12/3, 2019 at 14:34 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.