tomfran / typo

A simple Hugo theme
https://tomfran.github.io/
MIT License
237 stars 67 forks source link

Deployment w/ GitHub Pages #20

Closed wvirany closed 1 month ago

wvirany commented 2 months ago

Hi,

I am having trouble deploying the website with GitHub pages. For example, I have followed the setup instructions and have the site working on my local machine. How can I make this my personal webpage?

Thanks for the help

tomfran commented 2 months ago

You can follow this guide to setup a github.io domain page.

Then, your Hugo website project should contain a /public dir, this is the content that should go into the repo created following the guide. Pushing to it should deploy the running website.

I saw that you have your Hugo project directly into your *.github.io repo, which is wrong. Indeed this should contain the /public Hugo output.

In my website repo, I have the public folder as a git submodule linking to the website repo, this way, when I run hugo, the public folder gets updated. I can then just push this folder to have an updated website.

You can either do something like me, or if you don't mind versioning your Hugo project just do this:

Setup the hugo project and build the website

hugo new site <dir_name> --config toml && cd <dir_name>
git submodule add --depth=1 https://github.com/tomfran/typo.git themes/typo

From the same dir, setup your public folder

git clone git@github.com:wvirany/wvirany.github.io.git
mv wvirany.github.io public

Now make changes to your website, and run Hugo to have an updated public folder pointing to your github.io repo.

I started with this and then added make rules to automate this. You can find examples here.