If you're creating an open-source project or docs, go with Netlify, they're absolutely fantastic, and their team is a bunch of good people (e.g. Sarah and Cassidy, who you should follow on Twitter if you wanna see and learn cool stuff :)).
If you don't care about continuous deployment (imho, you should) and some of the work being automatized for you (imho, you should), but you do care about being able to host a dozen of sites, go with GitHub Pages. One great thing about both, they'll automatically deploy an SSL/TLS certificate for you, for free! (Thanks Let's Encrypt ♥)
Okay, we can get started!
Okay, now we can host our demo website on Netlify or GitHub Pages!
You'll need a GitHub, GitLab or Bitbucket account to host your site on Netlify, or a GitHub account if you're hosting on GitHub Pages.
I'll assume you have a GitHub account so I can show both Netlify and GitHub Pages.
First, you'll need to create a repository for your website.
On GitHub, click on the plus icon in the upper right corner and select
I'll name my repository demo and set it to be private and click
Cool, we now have a place to upload/publish our website.
Open up a terminal/shell in your website folder and enter the following:
git init # Initialises a git repository in the current directory git add . # Adds all of the files in the directory to the repository git commit -m "First commit!" # Records the changes made in the directory to the repo
Now go to your repository on GitHub and copy the quick setup URL:
And go back to the terminal/shell and enter:
git remote add origin https://github.com/yourUsername/yourRepo.git git push -u origin master
And your website should now be visible in your GitHub repository!
To host your site using GitHub pages, the static website files have to be either:
I think the easiest way is just to publish the
public folder containing the static files to a new
gh-pages branch, which you can do by opening up a terminal in your website folder and running:
git subtree push --prefix public origin gh-pages
And that's it really. Your website is now published at
If you're doing it this way, you'll need to push to both
gh-pages each time you want to publish your site. That way you'll keep the original source content files and publish the finished site.
One last thing to do though. Remember we said we'd need to update our
baseURL setting in
config.toml when we actually publish the site somewhere so Hugo knows how to create links? Let's do that now.
First, open up your repository on GitHub and open the
Settings tab in the upper right:
Scroll down to GitHub pages and copy your website URL:
baseURL in the
config.toml of your website:
baseURL = "https://ivanorsolic.github.io/demo/"
Compile the site and push the changes to your repository. This is what you'll be doing any time you've added new content or updated something on your website:
# Terminal at the website root hugo git add . git commit -m "Updated config.toml: baseURL" git push git subtree push --prefix public origin gh-pages
Now you can visit your website online at the URL you copied from your repo settings:
Pretty sweet, huh? You can even bundle the commands from above into a script and just run it anytime you want to publish your website.
First, sign up for Netlify using your GitHub account and authorize Netlify to access your GitHub account when the prompt comes up.
Next, click the
New site from Git button in the upper right:
Connect whatever Git provider you're using, I'll assume its GitHub:
Choose the repo containing your website:
If you're using Hugo, enter
hugo as the build command and
public as the publish directory, and click deploy site:
And that's it! Your website should be published on the URL Netlify has shown you after you've clicked on the
Deploy site button.