Startup Hugo theme for business

Hugo hosting on GitHub Pages

Configure Hugo

GitHub Pages serves content from the docs directory in your repository. By default, Hugo generates content in a public directory. To make GitHub Pages work with Hugo, you need to configure Hugo to generate content into the docs directory instead.

Open your config.toml file and add the following line:

publishDir = "docs"

Build your site

After making the changes in the config.toml file, rebuild your site with Hugo:

hugo

This will update the docs directory with the necessary static files.

Push changes to GitHub

Commit the changes made to your repository, including the generated static files in the docs directory.

Configure GitHub Pages settings

Go to your GitHub repository’s Settings tab. Scroll down to the GitHub Pages section. In the ‘Source’ dropdown, select the master branch /docs folder option. This tells GitHub Pages to serve your site from the docs folder in the master branch.

Click on the ‘Save’ button to apply the changes. GitHub Pages should now be enabled for your repository. You’ll see a green box indicating the URL where your site is published.

After a few moments, your Hugo site should be live on GitHub Pages. You can access it using the URL shown in the GitHub Pages section of your repository’s Settings.

Updating your site

Whenever you want to update your site, follow these steps:

  1. Make changes to your site’s content or configuration locally.
  2. Rebuild your site with Hugo hugo command.
  3. Commit and push the changes to your GitHub repository.

The changes will automatically be reflected on your live site hosted by GitHub Pages.