DEV Community

loading...
Cover image for Jekyll on Netlify

Jekyll on Netlify

michaelcurrin profile image Michael ・2 min read

Reasons to use Netlify

Custom builds

Easy custom builds that use npm run build before Jekyll build, or custom gems or a custom Ruby plugin you wrote.

A custom build setup is possible on GitHub Pages using GitHub Actions. But that is much more complicated to understand and configure and you have to handle installing and caching dependencies yourself, which Netlify does for you. I cover some GitHub Actions links at the end of this post.

Netlify will auto build a preview URL, like a staging site, on each Pull Request or branch created (depending how your configure it).

Debugging with logs

Netlify logs are way more detailed - GitHub Pages errors are often very generic ("there was an error with your build"), so I have to run the build locally to see what the full error is.

Or use GitHub Actions - which is unnecessary for the majority of my simple Jekyll sites where I want less to manage.

Repo hosting

It allows building from a private repo, if you so choose. Or even a GitLab or BitBucket repo.

Plugins

Netlify has a lot of free add-ons which you can enable per site with a choice in the UI or one line in a config file. For example, generate a sitemap file, do an accessibility check, render your Single-Page App as a static site (this means that Google SEO scoring will like your React app now) or optimize and compress assets.

These plugins are not available on GitHub Pages. You can do something similar on GitHub Actions but you have to choose from the marketplace and setup your workflow.

Lambdas

Did you know what you can use Netlify to run serverless code for free?

They are called Functions and they similar to the serverless endpoints or "Lambdas" you'll know from AWS. But Netlify is much simpler to setup.

A reason to use a Lambda is if you have data in a database or want to do server-side requests internally to an API, then you can make that data available on an endpoint that could say return JSON data. Which can get used by your frontend code.

CMS

Netlify also supports a CMS.

This allows you to setup an admin config file and have my-app.netlify.app/admin available for you and invited users to log in and manage content.

Discussion (0)

pic
Editor guide