There are lots of ways to create a personal website or a blog. You can design your own user interface and write the backend code. But not everyone is a web developer. And here comes SSGs to the rescue. Static Site Generators are little more than just website generators. In general, if you are looking for a simple blog, its better to use SSG than writing a lot of html and css. They are simple and elegant. Easy to maintain and you can add lots of customizations to your site without breaking or bloating your blog. There are lots of SSGs, Jekyll, Pelican and more complex ones like Gatsby, Hugo .
As you would have guessed by now, this blog is created using one such awesome SSG named Pelican. Pelican is simple, customizable and offers lots of themes and plugins. Pelican is python based SSG and is available through
# for reStructuredText only (recommended) python -m pip install pelican # for markdown and reStructuredText both python -m pip install "pelican[markdown]"
You can start a pelican project by typing following command. It will create a basic template and build configurations.
pelican-quickstart # output yourproject/ ├── content # Put your content here │ └── (pages) ├── output # Output files ├── tasks.py ├── Makefile # Makefile to run build and publish command ├── pelicanconf.py # Main settings file └── publishconf.py # Settings to use when ready to publish
Next step is to choose themes. As I said earlier there are lots of themes . And it is easy to create your own theme. Check here to create your own theme. My choice of theme was pelican-alchemy . This is a simple and great theme. Installing and removing themes in pelican is very easy.
# list all installed themes pelican-themes -l # output simple alchemy notmyidea # install new theme pelican-themes -i theme-path # remove a theme pelican-themes -r theme-name
To use a particular theme, set the
THEME variable in the pelicanconf.py file.
THEME = 'alchemy'
You can also use a theme that is not installed if you have all the required theme files. Just set this variable to its path.
THEME = 'path-to-theme-directory'
Various themes will have different feature, choose according to your need, or you can always add a feature through plugin. The next step is to build and check your blog. Pelican got it all set up.
# build your website make html # output "pelican" "/mnt/z/my_git/avinal.github.io/content" -o "/mnt/z/my_git/avinal.github.io/output" -s "/mnt/z/my_git/avinal.github.io/pelicanconf.py" Done: Processed 6 articles, 0 drafts, 1 page, 0 hidden pages and 0 draft pages in 2.43 seconds. # build and test/serve on localhost make serve # output "pelican" -l "/mnt/z/my_git/avinal.github.io/content" -o "/mnt/z/my_git/avinal.github.io/output" -s "/mnt/z/my_git/avinal.github.io/pelicanconf.py" Serving site at: 127.0.0.1:8000 - Tap CTRL-C to stop
Now open your browser and open 127.0.0.1:8000 or localhost:8000. You should be able to see your new blog. Stop local server using
CTRL+C. Next step is to publish it to github pages. Pelican has tools for this too. But wait we can do something more interesting here. Why not let GitHub take care of both building and publishing? Just push this project to a GitHub repository and set up GitHub pages. See this help for instructions on that. Before pushing to GitHub add this little script to your project.
#! /bin/bash ## file: publi.sh # install tools sudo apt-get install -y git make python3 python3-pip python3-setuptools python3-wheel # setup github config git config user.email "your-email" git config user.name "your-username" # install dependencies sudo pip3 install -r requirements.txt # pelican commands - install theme put your theme in themes directory pelican-themes --install themes/theme-name # publish to github pages ghp-import -m "Generate Pelican site" -b gh-pages output git push -f origin gh-pages
Now once your project is on GitHub, go to the Actions tab and click on set up a workflow yourself and paste the following code into the file and commit it.
# file: publish.yml name: Publish Blog on: push: branches: [ main ] pull_request: branches: [ main ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: set up permissions run: chmod +x publi.sh - name: Run a multi-line script run: ./publi.sh
If you have done everything correctly then go to https://username.github.io and you should see your blog. From now on whenever you want to add an article, just write it, test locally and push. Yay your blog is ready.
But My Blog is Special 🥰
My blog looks different, that is because I customized this theme a lot, especially headers, footers, and link appearance. And sorry I won't be publish my theme any time sooner. But I am listing down all the resources I have used for finally getting this result. You can always get my help by sending me a or starting a discussion on .
- Pelican Blog
- Pelican Docs
- Pelican Themes
- Pelican Alchemy Theme
- Parallax Star background in CSS
- Solar System animation
- EXODAR Font
- Overpass Mono
- Font Awesome
This Blog is licensed under Attribution-NonCommercial 4.0 International