I love GitLab pages. Being able to host a simple website with the same service I use for code makes managing services a lot more convenient. Of course with everything we use there are always alternatives. This post talks about a static site hosting alternative called Netlify.
Hosting with Netlify
Netlify offers many of the same features as GitHub pages but, since static site hosting is their primary service, they throw in a few added features. A couple of these features are the ability to do form submissions and compatibility with all static site generators. A complete comparison of features can be found here: https://www.netlify.com/github-pages-vs-netlify/.
Usually with additional features comes with the drawback of making a service more difficult to use. The Netlify team has made the setup process so convenient that this isn’t the case. Setting up Netlify is really as simple as pointing it to the location of your repository and it will update your website every time a push is made to the repository. Here what’s needed to get started.
Setting up Netlify
Netlify really has made the entire process very pain free. The first thing you will need to do is go to https://www.netlify.com and setup a free account. Once that is done we can really get started.
On the landing page of your your netlify account, click on the button to import a “New site form Git”.
Select your Git provider of choice and log in to your account.
You should now be presented with a list of all of your current repositories. Choose the repository containing your static site generator code.
Now comes the part that takes a little configuration. Since your master branch contains your production ready code, you can leave this first field alone. The next options are how your site is built. This can vary depending on the type of static site generator you are using. The following can be used for a Hugo based website.
Build command: hugo --minify
Publish directory: public
That’s all that it takes to get your site up and running on netlify.
Viewing your builds
After finishing setting up your site you will be taken to the landing page of the new website. Underneath the site’s name you can easily find the website’s URL. Clicking the link will take you to the version of the website that is currently live.
There may be times that you would like to know that the changes made to the website built successfully or finished building. This can be seen by going to the Deploys tab at the top of the Netlify page. The page changes to your current deploy settings and a list of all previous builds. Clicking on one of the previous builds will take you to a page with the summary of the build and the actually terminal output while generating the site.
This was just a brief overview to get you up and running using Netlify hosting services. There are too many features to fit into one post but you can watch upcoming posts to examine the different features in more detail.