Build a Jekyll Site
This article was generated by Chat-GPT 3.5 on 9/12/2023
Setting up a Jekyll site on Cloudflare Pages involves several steps, including configuring your repository, setting up your Jekyll project, and deploying it to Cloudflare Pages. Below, I’ll outline the process with code blocks to help you get started.
Step 1: Create a GitHub Repository
- Go to GitHub (https://github.com) and log in or create an account if you don’t have one.
- Click the ‘+’ button in the top-right corner and select “New Repository.”
- Fill in the repository name and other details.
- Choose “Public” or “Private” based on your preferences.
- Initialize the repository with a README file, but don’t add a .gitignore or license at this point.
- Click “Create repository.”
Step 2: Clone the Repository
Open your terminal and clone the repository you just created:
git clone https://github.com/your-username/your-repository.git
cd your-repository
Step 3: Set Up Jekyll Locally
Assuming you have Jekyll installed, create a new Jekyll project:
gem install bundler jekyll
jekyll new .
Step 4: Configure Your Jekyll Site
Edit the _config.yml
file in your Jekyll project to configure your site settings. You can do this using a text editor or the command line. Here’s an example:
title: Your Jekyll Site
theme: minima # Choose a Jekyll theme or create your own
Step 5: Commit and Push Changes to GitHub
Commit your changes and push them to your GitHub repository:
git add .
git commit -m "Initial commit"
git push origin main
Step 6: Create a Cloudflare Pages Project
- Go to Cloudflare Pages (https://pages.cloudflare.com) and log in or create an account if needed.
- Click “Create a project.”
- Connect your GitHub account and select the repository you created earlier.
- Choose the branch you want to deploy (e.g., main).
- Configure the build settings. For a basic Jekyll site, you can use the following settings:
- Build command:
bundle exec jekyll build
- Output directory:
_site
- Build command:
- Click “Save and Deploy.”
Step 7: Configure DNS
You’ll need to configure your DNS settings to point to Cloudflare. If you’re using Cloudflare for your domain’s DNS, follow their documentation for setting up custom domains with Cloudflare Pages.
Step 8: Deploy Your Site
Once your DNS settings are configured and propagated, your Jekyll site will be accessible through your custom domain or the Cloudflare Pages domain.
Step 9: Update Your Site
Whenever you make changes to your Jekyll site, push the changes to your GitHub repository. Cloudflare Pages will automatically rebuild and deploy your site based on the settings you configured.
That’s it! You’ve successfully set up a Jekyll site on Cloudflare Pages. You can now continue to develop your site, make changes, and have them automatically deployed to the web.