Maintenance

Site is under maintenance — quizzes are still available.

Go to quizzes
Sponsored Reserved space — layout preview until AdSense is connected
Tutorial

The Complete Guide to Setting Up a Blog With Static Site Generators

Learn how to set up a fast, secure, and free blog using Pelican, a Python-based static site generator. This step-by-step guide covers installation, writing posts, choosing themes, and deploying to GitHub Pages or Netlify.

July 2026 12 min read 1 views 0 hearts

If you've ever thought about starting a blog but felt overwhelmed by the complexity of WordPress or the cost of hosting, static site generators might be exactly what you need. They're fast, secure, and surprisingly simple once you get the hang of them. At PythonSkillset, we've helped countless developers and writers set up their own blogs using these tools, and I'm here to walk you through the entire process.

What Exactly Is a Static Site Generator?

Think of it this way: traditional websites like WordPress build each page on the fly when someone visits. That means every time a reader clicks a link, the server has to fetch data from a database, run PHP code, and assemble the page. Static site generators flip this around. They build all your pages ahead of time, turning your content into plain HTML files. When someone visits your blog, the server just serves those pre-built files. No database queries, no server-side processing. Just fast, clean pages.

This approach has some serious advantages. Your site loads incredibly fast because there's no backend work to do. It's also much more secure since there's no database to hack or vulnerable plugins to exploit. And hosting? You can put a static site on GitHub Pages, Netlify, or even an old-school web server for free or next to nothing.

Choosing Your Static Site Generator

The first big decision is which generator to use. The Python ecosystem offers several excellent options, but two stand out for blogging.

Pelican is the most popular Python-based static site generator. It's mature, well-documented, and handles everything from simple blogs to complex sites with multiple authors. You write your posts in Markdown or reStructuredText, and Pelican turns them into a complete website with categories, tags, and RSS feeds.

Lektor is another strong contender, especially if you want a more visual approach. It comes with a built-in admin interface that lets you edit content through a web browser, which is great if you're not comfortable working entirely in the command line.

For this guide, we'll focus on Pelican because it's the most widely used and has the largest community. But the principles apply to any static site generator.

Getting Started with Pelican

First, you'll need Python installed on your machine. Most systems come with it, but if you're unsure, open a terminal and type python --version. If you see a version number, you're good. If not, head to python.org and download the latest version.

Now, let's install Pelican and create your first blog:

pip install pelican markdown

This installs Pelican along with Markdown support. Next, create a new directory for your blog and navigate into it:

mkdir my-blog
cd my-blog

Now run the quickstart command:

pelican-quickstart

This will ask you a series of questions. Don't worry if you're not sure about some answers—you can change everything later. The important ones are:

  • Site title: This will be your blog's name
  • Author name: Your name as it appears on posts
  • Site domain: If you have a custom domain, enter it here. Otherwise, leave it blank
  • Time zone: Set this to your local time zone for correct timestamps

After answering the questions, Pelican creates a folder structure with everything you need. You'll see folders for content, output, and themes, plus a configuration file called pelicanconf.py.

Writing Your First Blog Post

All your content lives in the content folder. Create a new Markdown file there with a name like my-first-post.md. The file name becomes part of the URL, so keep it descriptive but short.

Every post needs metadata at the top. Here's what a basic post looks like:

Title: My First Blog Post
Date: 2024-01-15 10:20
Category: Tutorials
Tags: beginners, blogging
Slug: my-first-blog-post

This is the body of my post. I can write in **Markdown**, which means I can use bold, *italics*, and even code blocks.

```python
print("Hello, blog readers!")

The metadata section is called "front matter." The Title and Date fields are required. Category and Tags help organize your content. The Slug determines the URL—if you don't set one, Pelican generates it from the title.

Building Your Site

Once you have some content, it's time to build your site. Run this command from your blog's root directory:

pelican content

This processes everything in the content folder and generates the static HTML files in the output directory. To see what it looks like, you can start a local server:

cd output
python -m http.server

Open your browser to http://localhost:8000 and you'll see your blog. It won't be pretty yet—we'll fix that with a theme.

Choosing and Installing a Theme

Pelican comes with a basic default theme, but you'll probably want something more polished. The community has created hundreds of themes. You can browse them on the Pelican themes repository on GitHub.

To install a theme, download it and point Pelican to it. For example, let's use the popular "Flex" theme:

git clone https://github.com/alexandrevicenzi/Flex.git themes/Flex

Then in your pelicanconf.py file, add this line:

THEME = 'themes/Flex'

Rebuild your site with pelican content and refresh your browser. You'll see a much more professional-looking blog.

Customizing Your Blog

The real power of static site generators comes from customization. Let's look at some common tweaks you'll want to make.

Adding Navigation Menus

In your pelicanconf.py, you can define custom navigation links:

DISPLAY_PAGES_ON_MENU = True
DISPLAY_CATEGORIES_ON_MENU = True
MENUITEMS = [('About', '/pages/about/'), ('Contact', '/pages/contact/')]

Then create corresponding pages in your content/pages folder. For example, create content/pages/about.md with your bio.

Enabling Comments

Static sites don't have built-in comment systems, but you can easily add one using third-party services. Disqus is the most popular option. First, sign up for a Disqus account and get your site's shortname. Then add this to your pelicanconf.py:

DISQUS_SITENAME = "your-disqus-shortname"

That's it. Pelican will automatically add comment sections to your posts.

Setting Up RSS Feeds

RSS feeds are still important for many readers. Pelican generates them by default, but you can customize the settings:

FEED_ALL_ATOM = 'feeds/all.atom.xml'
CATEGORY_FEED_ATOM = 'feeds/{slug}.atom.xml'
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None

These settings create an Atom feed for all posts and separate feeds for each category.

Deploying Your Blog

Once your blog looks good locally, it's time to share it with the world. The easiest option for beginners is GitHub Pages. Here's how:

  1. Create a GitHub repository named yourusername.github.io (replace "yourusername" with your actual GitHub username)
  2. Build your site with pelican content
  3. Copy everything from the output folder into the repository
  4. Push to GitHub

Within minutes, your blog will be live at https://yourusername.github.io. If you have a custom domain, you can set that up too by adding a CNAME file to your output folder.

For more control, consider Netlify. It's free for personal projects and offers features like automatic deployment from Git, form handling, and HTTPS. You just connect your GitHub repository, and Netlify rebuilds your site every time you push changes.

Organizing Your Content

As your blog grows, you'll need a system for managing posts. Pelican supports several organizational features:

Categories group related posts. You can assign a category in the front matter of each post. For example, if you write about Python, you might have categories like "Tutorials," "News," and "Opinions."

Tags are more granular. A single post can have multiple tags, making it easy for readers to find related content. For instance, a post about web scraping might be tagged with "Python," "scraping," and "automation."

Pages are for static content like your About page or Contact form. They don't appear in the blog feed but can be linked from your navigation menu.

Working with Themes

The default Pelican theme is functional but plain. The real fun begins when you start customizing. You can find dozens of free themes online, or you can create your own.

To install a theme, download it and add the path to your configuration. For example, if you want to use the "Attila" theme:

git clone https://github.com/arulrajnet/attila.git themes/attila

Then in pelicanconf.py:

THEME = 'themes/attila'

Most themes come with their own configuration options. Check the theme's documentation for things like custom colors, logo placement, and social media links.

Automating Your Workflow

One of the best things about static site generators is how easy they are to automate. You can set up a system where you write a post, push it to GitHub, and your site updates automatically.

Here's a simple workflow using GitHub Actions:

  1. Create a .github/workflows/publish.yml file in your repository
  2. Add a workflow that runs Pelican whenever you push to the main branch
  3. Have it deploy the output to GitHub Pages

The workflow file looks something like this:

name: Build and Deploy
on:
  push:
    branches: [main]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: '3.9'
      - name: Install dependencies
        run: pip install pelican markdown
      - name: Build site
        run: pelican content
      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./output

Once this is set up, every time you push new content, your blog updates automatically. No manual steps, no FTP uploads.

Real-World Example: A Developer's Blog

Let me share how one of our readers at PythonSkillset set up their blog. Sarah is a data scientist who wanted to share her projects without spending money on hosting. She chose Pelican because she already knew Python.

She started with a simple structure: a homepage with her latest posts, an "About" page, and a "Projects" page. She used the "Flex" theme and customized the colors to match her personal brand. For comments, she added Disqus. For analytics, she added Google Analytics by pasting her tracking code into the theme's template.

The whole setup took her about two hours, including writing her first three posts. Now she publishes weekly, and her site loads in under a second.

Advanced Tips for Better Blogging

Once you're comfortable with the basics, here are some tricks that will make your blog stand out:

Use plugins wisely. Pelican has a plugin ecosystem that adds features like image processing, sitemap generation, and code syntax highlighting. Install them with pip and enable them in your configuration.

Optimize images. Large images slow down your site. Use tools like ImageOptim or Squoosh to compress images before adding them to your posts. You can also use Pelican's image processing plugin to automatically resize images.

Set up a newsletter. Static sites don't have built-in email lists, but you can integrate with services like Mailchimp or Buttondown. Add a signup form to your sidebar or footer.

Track analytics. Google Analytics works perfectly with static sites. Just add your tracking code to the theme's template, and you'll see visitor data without any server-side processing.

Common Pitfalls to Avoid

Even experienced developers make mistakes when starting with static site generators. Here are the most common ones I've seen at PythonSkillset:

Forgetting to rebuild. When you edit a post, you need to run pelican content again. It's easy to forget and wonder why your changes aren't showing up. Set up automatic rebuilding with a tool like pelican --autoreload during development.

Broken links. If you move a post or change its slug, old links will break. Use Pelican's redirect plugin or set up proper 301 redirects on your server.

Missing metadata. Every post needs at least a title and date. If you forget, Pelican might skip the post entirely or generate weird output.

Going Beyond the Basics

Once you're comfortable with the fundamentals, there's a whole world of possibilities to explore.

Custom themes let you create a unique look. Pelican uses the Jinja2 templating engine, which is the same one used by Flask. If you know basic HTML and CSS, you can build your own theme from scratch or modify an existing one.

Plugins extend Pelican's functionality. There are plugins for sitemaps, image galleries, code syntax highlighting, and even integration with services like Google Analytics. You can find them in the Pelican plugins repository on GitHub.

Multiple languages are supported natively. If you want to write in English and Spanish, Pelican can generate separate versions of your site with proper language tags.

A Practical Workflow

Here's the workflow I use for my own blog, and it works well for most people:

  1. Write a post in Markdown using any text editor (I use VS Code, but even Notepad works)
  2. Save it in the content folder with the proper front matter
  3. Run pelican content to rebuild the site
  4. Preview locally with python -m http.server
  5. When satisfied, push to GitHub

The whole process takes about five minutes per post once you're comfortable.

Common Questions Beginners Ask

Do I need to know HTML? Not really. Markdown is much simpler than HTML, and Pelican handles the conversion. But knowing basic HTML helps if you want to customize your theme.

Can I migrate from WordPress? Yes. Pelican has a tool called pelican-import that can convert WordPress XML exports. It's not perfect, but it handles most content well.

What about images? Store them in a content/images folder and reference them in your posts like this: ![Alt text]({static}/images/my-photo.jpg). Pelican will copy them to the output folder automatically.

How do I handle drafts? Add Status: draft to the front matter of posts you're not ready to publish. They won't appear in the generated site.

Going Live

When you're ready to share your blog with the world, you have several hosting options. GitHub Pages is the most straightforward for beginners. Here's the complete process:

  1. Create a repository named yourusername.github.io
  2. Build your site with pelican content -o docs (this puts the output in a docs folder)
  3. Push the entire repository to GitHub
  4. In your repository settings, enable GitHub Pages and set the source to the docs folder

For a more professional setup, use Netlify. It gives you a free subdomain, automatic HTTPS, and form handling. Just connect your GitHub repository, and Netlify detects the build command automatically.

Maintaining Your Blog

Once your blog is live, the workflow becomes second nature. You write a post, run pelican content, and push to your repository. The whole process takes about two minutes.

For longer posts, I recommend writing in a separate Markdown editor like Typora or iA Writer. These give you a clean writing environment without distractions. When you're done, copy the content into your Pelican post file.

Common Questions

What about images? Store them in a content/images folder. In your posts, reference them like this: ![My photo]({static}/images/my-photo.jpg). The {static} tag tells Pelican to copy the image to the output folder.

Can I have multiple authors? Yes. Pelican supports multiple authors out of the box. Just add an Authors field to your front matter.

What about search? Static sites don't have built-in search, but you can add it with services like Algolia or by using a JavaScript-based search library like Lunr.js.

The Bottom Line

Static site generators like Pelican give you the power of a full blogging platform without the complexity. You get fast load times, rock-solid security, and complete control over your content. And because everything is just HTML files, you can host your blog anywhere—even on a free service.

The learning curve is gentle, especially if you already know some Python. Start with a simple setup, write a few posts, and gradually add features as you get comfortable. Before you know it, you'll have a professional-looking blog that costs nothing to run and loads in the blink of an eye.

At PythonSkillset, we've seen developers use static site generators for everything from personal journals to technical documentation. The beauty is that once you set it up, you can focus on what matters most: writing great content.

Comments

Questions, corrections, and tips stay visible for everyone reading this page.

0 in thread

Join the discussion

Shown next to your comment.

Up to 4,000 characters

No comments yet

Be the first to leave a note — it helps the next reader.