Github Pages

Step 1: Enable GitHub Pages

In this course, you'll create a blog hosted on GitHub Pages and learn how to:

  • Enable GitHub Pages

  • Use Jekyll, a static site generator

  • Customize Jekyll sites with a theme and content

The first step to publishing your blog to the web is to enable GitHub Pages on this repository 📖. When you enable GitHub Pages on a repository, GitHub takes the content that's on the main branch and publishes a website based on its contents.

  1. Under your repository name, click Settings.

  2. In the "GitHub Pages" section, in the Source drop-down, select main branch.

Step 2: Customize your homepage

Create your homepage

  1. Navigate to the Code tab of this repository, and browse to the index.md file

  2. In the upper right corner, click the octicon-pencil icon to edit the index.md file

  3. Type the content you want on your homepage. You can also modify title: or just ignore it for now.

  4. Scroll to the bottom, type a commit message, and click Create a new branch for this commit and start a pull request

  5. Open a pull request

Step 3: Merge your pull request

Activity: Merge your pull request

  1. Click Merge pull request below.

  2. Click Confirm merge.

  3. Click Delete branch.

\

Step 4: Customize Site Details

Getting your page blog ready

Jekyll uses a file titled _config.yml to store settings for your site, your theme, and reusable content like your site title and GitHub handle.

You can check out the _config.yml file on the Code tab of your repository.

Activity: Modify the config file

Let's change the _config.yml so it's a perfect fit for your new blog. First, we need to use a blog-ready theme. For this activity, we will use a theme named minima.

  1. Navigate to the Code tab of this repository, and browse to the _config.yml file, or click this link here.

  2. In the upper right corner, click ✏️ to open the file editor.

  3. Add a theme: set to minima so it shows in the _config.yml file as below:

  4. Modify the other configuration variables such as title:, author:, and description: to customize your site.

  5. Click Create a new branch for this commit and start a pull request.

  6. Open a pull request.

Step 5: Create a blog post

Activity: Add some content to your blog

  1. On the "Code" tab, select your nishanthkumarpathi-patch-1 branch.

  2. Click Create new file.

  3. Name the file _posts/YYYY-MM-DD-title.md.

  4. Replace the YYYY-MM-DD with today's date, and change the title of your first blog post if you'd like. Note: If you do edit the title, make sure there are hyphens between your words.

    • If your blog post date doesn't follow the correct date convention, you'll receive an error and your site won't build. For more information, see "Page build failed: Invalid post date".

  5. Type a quick draft of your blog post. Remember, you can always edit it later.

  6. Commit your changes to your branch.

Step 6: Add blog post metadata

Activity: Add Front Matter to your Blog Post

  1. Click the "Files Changed" tab in this pull request.

  2. There are two files in the "Files Changed" tab, the _config.yml file and the _posts/YYYY-MM-DD-title.md file. Make sure to edit the file in the _posts folder.

  3. Click on the icon to edit on the right side of the screen.

  4. Type the following content at the top of your blog post:

  5. Replace YOUR-TITLE with the title for your blog post.

  6. Replace YYYY-MM-DD with today's date.

  7. Commit your changes to your branch.

Last updated