Search code examples
rhugoblogdown

Why is my served site not rendering with this error?


New to both Hugo & Blogdown. In a new R project called personal-blog I ran

blogdown::new_site(theme = "lxndrblz/anatole") and even after doing blogdown::build_site() and restarting the Rstudio I get the following

C:\Users\myName\AppData\Roaming\Hugo\hugo.exe server --bind 127.0.0.1 -p 4321 --themesDir themes -t anatole -D -F --navigateToChanged
Serving the directory . at http://127.0.0.1:4321
Launched the hugo server in the background (process ID: 19844). To stop it, call blogdown::stop_server() or restart the R session.

None of the site formats properly. Supposed to look like what you see here. But none of the formatting is right on my local server. I don't see any of the CSS.

EDIT: Regarding the warning I got below with respect to Rtools -- it had something to do with MinGW and my version of R (4.0.3). When I was using my machine's default version R 3.6.1 nothing was working. I downloaded Rtools (this is not an R package from my understanding, it is something entirely different that you get from CRAN) Rtools from CRAN

Once I reinstalled Rtools, added it to my system PATH and did it for both 32 & 64-bit versions, blogdown went back to working for me. Blogdown wasn't really the problem it was Rtools & MinGW not working nicely from what I can tell. Now I'll try to develop my blog.


Solution

  • I have fixed this issue in the dev version of blogdown, which you may install with (remember to restart R):

    remotes::install_github('rstudio/blogdown')
    

    The problem was because the theme used the Hugo function absURL for CSS files, which led to URLs of the form http://localhost:port/path/to/css, but the site was viewed from http://127.0.0.1:port, and the CORS issue of the browser prevented the CSS files from being loaded.