Skip to main content

Convert a Blogger Atom export to Hugo Markdown with configurable slugs and link sanitization.

Project description

Blogger → Hugo Markdown Converter

Convert a Blogger Atom export (blogger.xml) into Hugo Markdown files.
Supports configurable slugs, link sanitization, and choice between flat files (slug.md) or nested (slug/index.md).


Features

  • Slug control:
    • --slug-mode link | title | id | date-title | id-title
    • --slugify ascii | unicode | none
  • Link sanitization:
    • Strip tracking params (utm_*, gclid, etc.)
    • Drop hash-only links
    • Optionally unwrap image lightbox links
    • Or strip all links to plain text
  • Flat file option:
    Use --flat to write post.md instead of post/index.md.
  • Draft handling:
    Drafts skipped by default; include with --drafts.
  • Pages vs posts:
    Blogger "pages" exported separately (--pages-out).

Installation

Requires Python 3.8+.

pip install html2text python-slugify beautifulsoup4

Save the script as blogger2hugo.


Usage

Export your blog from Blogger: Settings → Back up content → Downloadblogger.xml.

Convert:

python blogger2hugo blogger.xml --out content/blog

Common options

  • Slug mode

    --slug-mode date-title   # YYYYMMDD-my-title
    --slug-mode link         # from Blogger’s canonical link
    --slug-mode id           # numeric post ID
    --slug-mode title        # slugified title
    --slug-mode id-title     # <id>-<title>
    
  • Slugify style

    --slugify ascii     # transliterate to ASCII (default)
    --slugify unicode   # keep original script (e.g. فارسی titles)
    --slugify none      # minimal cleanup only
    
  • Flat files

    --flat
    # results in content/blog/2023/01/my-post.md
    # instead of content/blog/2023/01/my-post/index.md
    
  • Link sanitization

    --links keep
    --links text
    --links notracking,nohash,unwrap-images   # default
    
  • Pages output

    --pages-out content/page
    

Examples

Keep Unicode slugs, clean links, and flat files:

python blogger2hugo blogger.xml \
  --out content/blog \
  --slug-mode date-title \
  --slugify unicode \
  --links notracking,nohash,unwrap-images \
  --flat

Use Blogger IDs as slugs, keep original link structure:

python blogger2hugo blogger.xml \
  --out content/blog \
  --slug-mode id

Include drafts:

python blogger2hugo blogger.xml --out content/blog --drafts

Output structure

Example with --flat --slug-mode date-title --slugify unicode:

content/
└── blog/
    └── 2023/
        └── 01/
            ├── 20230120-hello-world.md
            └── ...

Each Markdown file contains YAML front matter:

---
title: "hello-wrold
date: "2023-01-10T08:30:00Z"
lastmod: "2023-01-10T08:45:00Z"
draft: false
tags:
  - "Example"
slug: "20230110-hello-wrold"
---

Followed by the body in Markdown.


Notes

  • Images are left as-is; for local copies, run a separate fetcher.
  • Blogger “read more” markers are removed.
  • Pages and posts are separated (--out, --pages-out).
  • Compatible with Hugo extended.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blogger2hugo-0.1.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blogger2hugo-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file blogger2hugo-0.1.0.tar.gz.

File metadata

  • Download URL: blogger2hugo-0.1.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for blogger2hugo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 769e67c34c091a4fbfe6320214efb89a99eb9e732059b00ec023a4e5b78aafe4
MD5 6f205642332366d70765e01f5d7beee0
BLAKE2b-256 83625edda906aac5ff945aaf01f83a7058c715b0896c7c6b93a6508352f1aea5

See more details on using hashes here.

File details

Details for the file blogger2hugo-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: blogger2hugo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for blogger2hugo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd886eb55736db3c39e9178614514ab82e4e84289a0e2dfba7208402298dd7b3
MD5 4eed5eee047327f25e9185ac10626882
BLAKE2b-256 56dde72962e51de0875c81657a53c2fbeb2e48dae450ad6bdf06db50239e9192

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page