Skip to main content

⚠️ The project has been rewritten in rust, development continues here ⚠️

Gitblog2 Logo Gitblog2

Git + Markdown = Blog

PyPI Version

Gitblog2 is a blog generator focused on speed and simplicity.
Blog posts are written in Markdown and that's it.
Look at it yourself: this live example is solely based on this repository.

Features

  • Build static HTML files from Markdown files. No JavaScript, no divs, no css classes.
  • Low footprint (about 10kB compressed).
  • Profile picture and social accounts included based on your Github profile.
  • RSS and Atom feeds.

Installation

pip install gitblog2

There's also a container image available on docker hub.

Usage

From the command line:

gitblog2 https://github.com/HenriTEL/gitblog2.git --repo-subdir=example --base-url=https://example.com --no-social

From the library:

from gitblog2 import GitBlog

source_repo = "https://github.com/HenriTEL/gitblog2.git"
output_dir = "./public"
url_base = "https://example.com"
with GitBlog(source_repo, repo_subdir="example") as gb:
    gb.write_blog(output_dir, base_url=url_base, with_social=False)

From the container:

docker run --rm -v $PWD/public:/public \
    -e SOURCE_REPO=https://github.com/HenriTEL/gitblog2.git \
    -e REPO_SUBDIR=example \
    -e BASE_URL=https://example.com \
    -e NO_SOCIAL=true \
    henritel/gitblog2

Roadmap

  • support frontmatter
  • git comments
  • strike through not working (both ~ and ~~)
  • Gemini support (feeds included)

Improve the CLI using tips from https://clig.dev:

  • Once installed, show what commands to run to actually start using it
  • Comprehensive help texts
  • Provide lots of examples
  • Suggest what command to run next
  • Suggest what to do when there is an error.
  • Provide useful commands to debug nd explore, maybe gitblog2 tree to have a look at what the generated blog would look like, gitblog config to find what options are enabled/disabled. Think about ways to show metadata on articles like the updated/created at fields, maybe also list the custom templates and what articles would make use of them.
  • Add a dry-run option
  • Think about detecting misconfigurations, providing helpful message that point toward the right direction (e.g. line number in the faulty template).
  • On the other hand, say when everything looks good (gitblog troublesoot?).
  • Autocompletion?
  • Not printing scary-looking stack traces, explain errors instead.
  • Link the docs and code on the help page
  • Link the code from the docs
  • Make sure to exit with 0 for success and non-zero otherwise
  • Make sure only machine readable content goes to stdout
  • Messaging goes to stderr
  • Provide terminal-based documentation (and maybe a man page)
  • Use colors and ASCII art (like in ls -l) when relevant (output stream == TTY -> human), also ckeck the NO_COLOR or FORCE_COLOR envs.
  • Think about --json, --plain and --jsonl to format the output for computers
  • Provide -q to avoid all text output
  • Use emojis to catch the user’s attention on critical things
  • When stderr is a TTY, add criticity in logs only in verbose mode, and write the catched error in red at the end + a solution
  • When stderr is not a TTY it's ok to output log levels, also tracebacks for unexpected or unexplainable error
  • Add progress indicators for long operations (progress bar like docker pull?)
  • Have some cache capabilities and make long operations recoverable
  • Defer cleanup operations to the next run (exit faster on first error encountered)
  • Make sure that env vars are only for user-specific config, settings that are likely to change on a run basis should be flag-only (e.g. -v, --quiet, --dry-run)
  • Don't read secrets from env. Only via credential files, pipes, AF_UNIX sockets, secret management services, or another IPC mechanism.
  • Make it a standalone executable with something like https://github.com/pyinstaller/pyinstaller
  • Have a command to uninstall it, print it at the end of the installation process.

Low priority:

  • Check https://github.com/h5bp/html5-boilerplate
  • If avatar already present, don't attempt to download it and include it in the blog.
  • Add gitlab support
  • Add about page (and link to it from pp) based on user bio and README.md
  • Use user's profile handle first and commit author only as a fallback
  • E2E tests
  • Deal with code's TODOs or make issues for newcomers
  • Improve score on https://pagespeed.web.dev/analysis/https-blog-henritel-com/oktd50o2sy?form_factor=desktop
  • Add doc for customisation
    • Change template + accessible variables
    • Add icons
    • Change main color theme
  • Make a script to remove unused icons
  • Make a better TOC extension (remove div and classes)
  • Make markdown renderer set loading="lazy" on img tags
  • Unit tests, pagespeed test
  • Refactor lib.py
  • Add contributing section
  • Remove div and classes from footnotes

Great content

https://accessiblepalette.com
https://modernfontstacks.com/
https://anthonyhobday.com/sideprojects/saferules/
https://lawsofux.com/
https://developer.mozilla.org/en-US/docs/Web/HTML
https://developer.mozilla.org/en-US/docs/Web/CSS
https://developer.mozilla.org/en-US/docs/Web/SVG
https://icons.getbootstrap.com/

Classless stylesheets candidates

https://github.com/kevquirk/simple.css/blob/main/simple.css
https://github.com/yegor256/tacit
https://github.com/kognise/water.css
https://github.com/xz/new.css
https://github.com/edwardtufte/tufte-css
https://github.com/programble/writ
https://github.com/oxalorg/sakura
https://github.com/susam/spcss

Metadata

Release files for gitblog2 2.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitblog2 2.3.2
File Size Uploaded
gitblog2-2.3.2.tar.gz 56.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gitblog2 2.3.2
File Interpreter ABI Platform
gitblog2-2.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 86.1 kB

Release files / gitblog2-2.3.2.tar.gz

Download URL gitblog2-2.3.2.tar.gz
Size 56.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4073b0decf2d3bbfe0dd1dde139bb6fa44b6a17f1432b6f7fe847c5e3f0db73a
BLAKE2b-256 checksum
How to use checksums
f5b6631ed04e6d0d762c85292c00a290e9805e54781f2d853d232aed8bfbc462
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / gitblog2-2.3.2-py3-none-any.whl

Download URL gitblog2-2.3.2-py3-none-any.whl
Size 29.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08ed3f9b0c1d2f17170784974cc87b73cda9412f5bb747e8390ff13c13f2d84c
BLAKE2b-256 checksum
How to use checksums
0df468f032f5238b3efb0424040089ff49e451ab67a5bd3e617f720aa1c5fcf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

2.3.2 This release

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page