Git + Markdown = blog
Project description
Gitblog2
Git + Markdown = Blog
TODO
High priority:
- Add bio and picture from github
- Draft support (set publish_date to first
mv
) - E2E tests
Low priority:
- Unit tests
- Fix root index.html not served by redbean
- Make it work on non-unix systems (mainly dealing with windows file system separator)
Installation
pip install gitblog2
Usage
As a command line:
gitblog https://codeberg.org/HenriTEL/git-blog.git --repo-subdir=example
As a library:
from gitblog2 import GitBlog
source_repo = "https://codeberg.org/HenriTEL/git-blog.git"
output_dir = "./www"
with GitBlog(source_repo, repo_subdir="example") as gb:
gb.write_blog(output_dir)
As a container:
docker run --rm -v $PWD/www:/www \
-e SOURCE_REPO=https://codeberg.org/HenriTEL/gitblog2.git \
-e REPO_SUBDIR=example \
henritel/gitblog2
Deploy to Cloudflare Pages using Github Actions
You can write your blog on GitHub and automatically push changes to Cloudflare Pages using this GitHub Action:
name: Publish Blog
on:
push:
branches: [ main ]
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: docker://henritel/gitblog2
with:
args: post-css cloudflare-pages
env:
SOURCE_REPO: https://github.com/${{ github.repository }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
Don't forget to set your cloudflare secrets.
Dev quickstart
Make sure to have poetry installed, then
Setup your local web server:
wget "https://redbean.dev/redbean-tiny-2.2.com" -O redbean.zip
zip redbean.zip -j providers/assets/.init.lua
chmod +x redbean.zip
In one terminal, update the blog as needed:
poetry run gitblog2 --repo-subdir example -l debug
In another terminal, serve the blog:
./redbean.zip -D ./www
Internals
Stylesheet is based on water.css
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
gitblog2-1.0.0.tar.gz
(13.7 kB
view hashes)
Built Distribution
Close
Hashes for gitblog2-1.0.0-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdf18ea7f098bdb246620a3d4099772d41533d44521f457d9d41b2f2ce7c13be |
|
MD5 | 2ddbb7b4a97eb4443391fe44c439d8d6 |
|
BLAKE2b-256 | 4430e105af6eac900824070bc0dd154c16a355a0bb260cec69aeea0fe73510e6 |