Finally! My blog is ready, and here's how you can have yours.

Hello there! Welcome to my daily blog.

Why create another blog while I have Hashcode blog already

Well, the reason is quite simple. I plan to use Hashnode for technical or lengthy explanations, while this blog will be dedicated to sharing my weekly progress on open source contributions, as well as tips and tricks I've learned along the way

Let's see how you can setup your blog on gitbub pages for free using Pelican open source static site generator and can write in markdown or .rst files.

Intresting right?

Step 1 : Installation

Go to your directory /my-blog

Create virtual environment and activate it.

Now install pelican

python -m pip install "pelican[markdown]"

Step 2 : Create a Project

Create project in the current directory itself /my-blog

> pelican-quickstart

Select . for current directory as well as all other opetions that are asked.

After completion you should be able to see /content, /author, etc. directories.

Inside /content directory create a file called 1st-post.md

./my-blog/content/1st-post.md

Now add following content into this file

Title: My first title
Date: 2023-09-18 09:20
Modified: 2023-09-18 09:20
Category: Open source
Tags: open source, pelican
Slug: testing-my-blog
Authors: Yourname
Summary: Short summary of blog

Write your blog here 🚀

Step 3 : Generate and Preview

To generate site run following command

pelican content

The site has been generated inside /output directory

To preview run following command

pelican --listen

Now you can see the preview of your site at localhost on port 8000

If you've got any dificulties you can refer Pelican quick start docs

Congratulations 🎉 your blog is ready to be deploy!.

Change to Other Themes

We will be changing theme to the Attila. You can see demo here

Download the theme from here and put unzipped directory to the root of /my-blog

Now run following command to add to pelican

pelican-themes -U attila

To list all the themes run following command

pelican-themes -l

Now if you are able to see the theme name in the list, you have to add theme name into pelicanconf.py file. like following.

THEME = "attila-1.6"

Horray 🎉 Theme changed!

Publish to Github Pages

Clone the empty repository or initialize this current directory

Now run following command

> pelican content -o output -s pelicanconf.py
> ghp-import output -b gh-pages
> git push origin gh-pages

After pushing you also need to push it to main branch.

Then go to settings > Pages > select source branch as gh-pages and root directory and hit save button.

Now it will run github actions for deploying the content in gh-pages branch.

Now the remaining step is sharing your link on socials 😀

Thanks for reading.

Reference Links

Publish to GitHub Pages : Link

Attila Theme : Link