How to deploy the site on Github Pages?

I read Yihui's book and want to deploy my site on Github Pages.
Because of the directory for publishing named by public, seemingly Github cannot recognize the public directory.

In the book, the directory named by public is created by Hugo. Could I just change it name into docs to fit Github pages?
Or any alternative to solve it in an automatic way

It's a lot of tinkering to get right.

Create a repository on git hub and clone it to your local drive. Create a new project in rStudio.

Use the new post addin to create a post, the serve site addin to create all the subsidiary folders and the console blogdown::hugo_build() command to populate the public folder.

Your gitpages folder can be named anything, but you get only one github address. The workaround is to have an index.html in your github root that points to your different hugo site directories or redirects to a single one.

For example and lead to the same page.

For blogdown, I followed Yuhui's suggestion and worked with deployment via to


Hi @technocrat I follow your tips and run a sample website built by blogdown. But it doesn't work.
Here is my blog site url.

And I find my github page is just the

That is weird.
Because I have chosen the docs folder.

In github in that repository, does it contain anything other than the read_me? It's not public, so I can't tell. As before, yuhui doesn't recommend gitpages because of the involved configuration and you are only allowed one per account. I haven't tried it yet, but my success with _book_down convinces me that it should be possible to deploy to a public repository with an index.html at the top level redirecting to the real Hugo generated index in the /public file.

Amber Thomas wrote up some very good instructions that go a bit into more detail than in the blogdown book:

1 Like