Skip to main content

Tiny static website generator.

Project description

Picogen

A very simple static website generator that uses Jinja to generate your content.

Installation

Create/activate virtual environment and install picogen in your working directory.

python3 -m venv .venv &&
source .venv/bin/activate &&
pip install --upgrade pip &&
pip install picogen

Working Directory Structure

In your working directory you need to have the following structure where you'll have an .env file, a content directory in which you'll have your markdown files, and optionally if you don't use the default theme that ships with picogen you'll need a themes directory in which you'll have your own theme. You need to follow this exact same structure in order for picogen to know what to look where. Note, the inclusion of sitemap.xsl in your custom theme is optional. You can also include aditional templates that extend or use the existing templates.

├── .env
|
├── content
|   ├── posts
|   │   ├── post_1
|   │   │   ├── post.md
|   │   │   └── images
|   |   |       ├── image_1.jpeg
|   |   |       └── image_2.png
|   │   └── post_2
|   │       ├── post.md
|   │       └── images
|   |           └── image.jpeg
|   └── pages
|       └── page_1
|           ├── page.md
|           └── images
|               └── image.jpeg
|
└── themes                      // optional
    └── custom_theme
        ├── static
        │   ├── css
        │   ├── favicons
        │   └── images
        └── templates
            ├── home.html        // homepage
            ├── post.html        // each article
            ├── page.html        // each page
            ├── category.html    // each category
            ├── 404.html         // 404 page
            ├── robots.txt       // robots file
            ├── sitemap.xml      // sitemap xml file
            └── sitemap.xsl      // sitemap xsl file (optional)

Config

The .env file should have the following content, out which all of the values are optional. If you use your own custom theme though you need to designate its directory name (THEME) in the .env file.

# .env file

SITE_URL=
SITE_NAME=
SITE_TAGLINE=

THEME=
GTAG_ID=
CONTACT_EMAIL=

Writing Content

Every markdown file at the top needs to have a metadata section wrapped with ---. Picogen will look for this section in each markdown file and will warn you if something is missing. For example here's a post metadata:

---
Title: Here Goes the Title
Date: 2017-10-30 10:20
Modified: 2017-10-30 10:20
Category: Here Goes the Category
Image: relative/path/to/image.jpg
Slug: example-url-slug
---

Build, Serve, Deploy and Backup

Type picogen -h for help.

picogen [-h] [-g] [-d BUCKET_NAME] [-b BUCKET_NAME]

Examples to build, deploy and backup your website:

picogen --generate --deploy bucket_name --backup bucket_name
picogen -gd bucket_name -b bucket_name

The website will be generated within the build directory. During the build, all the files in the static/favicons directory in your theme will be copied over to the root of the build too.

The config variable that containes the values from your .env file is available to all of the jinja templates. Also variables posts, pages and categories that contain all posts, pages and categories are available to all jinja templates. Additionaly, single post, page and category variables are available to the templates with the same names respectively.

To serve your website locally on port 8000 you can use:

python -m http.server --directory build --bind localhost

References:

License

License: MIT

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

picogen-0.0.13.tar.gz (50.5 kB view details)

Uploaded Source

Built Distribution

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

picogen-0.0.13-py3-none-any.whl (54.5 kB view details)

Uploaded Python 3

File details

Details for the file picogen-0.0.13.tar.gz.

File metadata

  • Download URL: picogen-0.0.13.tar.gz
  • Upload date:
  • Size: 50.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for picogen-0.0.13.tar.gz
Algorithm Hash digest
SHA256 543bcb5cfd8bb3baec39c880db759eda991ec67b3e2d79c81eeae051d4529e9f
MD5 1c97e123e3127d40c0bcd2c8b634fed4
BLAKE2b-256 7bd0c6b813091b8d93051d0ce43ddab5542c3ca09e580951585605d6047080e7

See more details on using hashes here.

File details

Details for the file picogen-0.0.13-py3-none-any.whl.

File metadata

  • Download URL: picogen-0.0.13-py3-none-any.whl
  • Upload date:
  • Size: 54.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for picogen-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 de182f22fb79df098c8d4ea93798482253e36aa4f020ee7361a706e43104781d
MD5 fc2e929673c63d82a0689f06d0269fc7
BLAKE2b-256 c9f880c9e2a9cc271213b1f8a032154d84153f9d4ba16baf6129e0739ce7f9b8

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