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?

Community
  • 1
  • 1
antecessor
  • 2,688
  • 6
  • 29
  • 61

3 Answers3

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
antecessor
  • 2,688
  • 6
  • 29
  • 61
  • Hi all, I acually added these 2 lines of code. but still the same page (2nd Image of the question) – Dev P Jan 03 '20 at 11:56
  • It is probably because the css is not loaded correctly, check that the link to the css files are starting with `https:` – Julien Colomb Jan 08 '20 at 08:09
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.

mhhollomon
  • 965
  • 7
  • 15
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

rmg
  • 1,009
  • 16
  • 31