Blogdown: getting relative links to work


After I set up a blogdown site in my GitHub space, I cannot seem to get the links to my posts to connect correctly. So far, I have my site at

and I have my config.toml file set with

  • baseurl = ""

(failed to work if I included “public/” or not in the baseurl). The post RMD files are back in

  • …/blog/content/post/

Do we really have to install a Hugo site in the master directory?


I didn’t host my blog via GitHub, but if I’m reading things correctly I think you will need a “” repository (with your actual username in place of “username”)…

I base this guess on the blogdown book chapter on GitHub but, as I said, I haven’t tried it so can’t verify. :grinning: Once you have that repository then your baseurl would be "".

You may also find this blog post useful (if you haven’t seen it already).


Hi- @aosmith is right- you need to change the baseurl in your config file to Check out Amber’s blog post:

And this section in the blogdown book as @aosmith already suggested:

You may also want to look into other options aside from GitHub pages, like Netlify (Yihui’s blog post on the topic). See this part of the blogdown book:

I also did a blog post documenting the steps using Netlify and GitHub here: