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
- Strip tracking params (
- Flat file option:
Use--flatto writepost.mdinstead ofpost/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 → Download → blogger.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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
769e67c34c091a4fbfe6320214efb89a99eb9e732059b00ec023a4e5b78aafe4
|
|
| MD5 |
6f205642332366d70765e01f5d7beee0
|
|
| BLAKE2b-256 |
83625edda906aac5ff945aaf01f83a7058c715b0896c7c6b93a6508352f1aea5
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd886eb55736db3c39e9178614514ab82e4e84289a0e2dfba7208402298dd7b3
|
|
| MD5 |
4eed5eee047327f25e9185ac10626882
|
|
| BLAKE2b-256 |
56dde72962e51de0875c81657a53c2fbeb2e48dae450ad6bdf06db50239e9192
|