Skip to main content

Static site generator based on staticjinja with support for templates (Jinja), translations (pyBabel), optimized thumbnail generation (Pillow), and build size minimization by excluding unreferenced files.

Project description

bSSG – B Static Site Generator

bSSG is an extensible static site generator that builds on top of staticjinja. It includes support for templates (Jinja), translations (pyBabel), optimized thumbnail generation (Pillow), and build size minimization by excluding unreferenced files.

Features:

  • Support for templates (with Jinja)
  • Support for translations (with pyBabel)
  • Includes a thumbnail generator for responsive images (uses Pillow)
  • Efficient output by including only referenced static files
  • Opinionated on URL structure

Architecture

A site that uses bSSG will have this URL a source structure as:

input/
 +- templates/
 |   +- <tree>
 +- static/
 |   +- <static files used in templates>
 +- translations/
     +- <language code>/
     |   +- LC_MESSAGES/
     |       +- messages.po
     ...
     +- <language code>/
         +- LC_MESSAGES/
             +- messages.po

And the generated site will be structured as:

output/
 +- <language code>/
 |   +- <tree>
 ...
 +- <language code>/
 |   +- <tree>
 +- <static files used in templates>
 +- thumb/
     +- <generated thumbnails>

And after generation, it can be accessed by an URL with the form {URL_PREFIX}/[{LANG_CODE}/]{SUFFIX}. Since the generated site is static, a web server has to be configured so that URL_PREFIX points to the path of the output directory.

An additional prefix (STATIC_PREFIX) can be added for static files so that they are not all placed directly at the root. Thumbnails are generated to the static files directory, but an additional prefix (THUMB_PREFIX) may be added to use an exclusive directory for thumbnails.

Usage

Creating a website with bSSG can be done as follows:

  1. Write the jinja templates, using _('...') for localized strings, the static filter for static files, and the thumb and thumb_src filters for images that want to thumbnailize.
  2. Translate (if applicable).
    1. Extract the translations from the templates to a .pot file.
    2. Update (or init, if it is the first time) the message catalogs (one .po file for each language).
    3. Compile the message catalogs (generates one .mo file for each language).
  3. Build the site. The script will make the thumbnails, use the compiled translations, and generate the localized trees following the structure of the templates.

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

bssg-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

bssg-0.1.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bssg-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for bssg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f86d8de5a0a6885837f847c73557fb1996f89a43ecc41216fcd6d3a756e1efa9
MD5 be463e42137032513c3bb85ccad75c27
BLAKE2b-256 89b49574942ac3dc7f6e5b99546355d41bba3e6be83838731bcd18f3d7fdf698

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bssg-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for bssg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1bc1e5a05aa107e16fef284908f895507936be82e2662b3a79926fb1cf0d5fe
MD5 0a038330ee27880fc5872f51938dbac3
BLAKE2b-256 f281b018e62f91bfe5d9a961048e5f4780705767640de609fe3f5a60ea7d9494

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