7 July 2023

Build A Blog With Jekyll And GitHub Pages

Table Of Contents

Benefits Of Jekyll

Installation And Setup

Install Jekyll on Windows

Deploy Jekyll on GitHub Pages

Customization

Change Default Jekyll Theme

I wanted to change the default Jekyll to something closer to what I wanted, and decided to use Minimal.

The separate SCSS-file is to keep all your custom properties separate from the base theme, so you retain modality. All properties in this file will overwrite the theme sheet, because they will be applied last when files are merged.

I eventually I replaced the whole CSS and developed my own theme, so it will not look like this when installed.

The default permalinks in Jekyll uses the following format by default:

/:categories/:year/:month/:day/:title:output_ext

I wanted to simplify, so I added the following to _config.yaml:

permalink: /:title/

Display Blog Posts On Homepage

I wanted to display blog posts on the homepage, so I added the liquid post loop to the index file. You can do something like this to render every post in your _posts folder as a title link. Each post get an entry in the list.

<ul>
{% for post in site.posts %}
    <li><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>

Add Mermaid Support To Jekyll

I wanted to add support for using Mermaid charts in Markdown, I so added the following to the head of the HTML template:

<script type="text/javascript" src="https://unpkg.com/mermaid@10.2.4/dist/mermaid.min.js"></script>

Add the initializing script at bottom of the body, before the closing body tag:

<script>mermaid.initialize({startOnLoad:true});</script>

Now, Mermaid syntax gets rendered when written inside the following element:

<div class="mermaid"></div>

Other Tips

🡐 Back to archive