How to deploy the site on Github Pages?

I read Yihui's book https://bookdown.org/yihui/blogdown/ 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 https://technocrat.github.io/ and https://technocrat.github.io/_book lead to the same page.

For blogdown, I followed Yuhui's suggestion and worked with deployment via netify.com to rbind.io.

3 Likes

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.

https://github.com/JiaxiangBU/blog_181115

And I find my github page is just the readme.md.

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 UNIQUE.github.io 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: https://amber.rbind.io/blog/2016/12/19/creatingsite/#initializing-github-pages-to-work-with-hugo-and-blogdown

1 Like