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

孤街醉人 提交于 2020-01-06 11:44:40

问题


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.

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

I am employing the theme Mainroad with this base URL:

baseurl = "/"

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


回答1:


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



回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/54972527/bad-rendering-of-the-local-index-html-from-public-folder-using-hugo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!