Skip to main content

Stone

Yet another static website generator, with plugin support.

Used by (www|blog).half.systems to convert Markdown and Jinja2 into HTML.

Installation

$ pip install stone-site

Usage

To get started with stone:

# Create template layout
stone example_site init --site-name 'example.com'
# Generate site
stone example_site generate
# Add a new page
stone example_site newpage --name "About Us"

By default Stone is configured to turn Markdown + YAML metadata + Jinja2 templates into HTML but as it has support for custom plugins it can generate anything it has code for.

Site Configuration

Configuration File

Stone generates sites based on the contents of site.json. Each site can specify which backends, generators and renderers to use, custom versions will be loaded from the $HOME/.stone directory.

Example

An example project that generates an example landing page and blog is included in Stone’s project source. you can build it by running:

stone example generate

Folder Structure

Stone was originally designed to generate the subdomains of half.systems. The following is the layout of the sites:

.
├── blog
│   └── ...
├── main
│   └── ...
├── site.json
└── templates
    └── ...

site.json is flexiable about the location of templates and files. As such your not constrained to any particular layout for your site. You could have separate template folders inside each site or one shared in the project root. Each site can specify its template directory

Pages

By default pages are Markdown file, that can have optional YAML metadata that describe the attributes of the page including the title and which template to uses. For example:

template: base.html
title: Hello, World

# This is a header

Here is some lovely content.

Stone makes all metadata available to page templates. Any data templates may use can be embedded into a page. For exampled: an author’s name, email, the date the page was written. The behaviour is dependent on the generator and renderers used. See the [renderers](docs/renderers.md) and [generators](docs/generators.md) for more details.

Templates

By default templates are HTML pages with jinja2 markup.

base.html:

<html>
  <head>
    {% block head %}
    <title>{{ title }}</title>
    {% endblock %}
  <head>
  <body>
  {% block body %}
    <h1>{{ title }}</title>
    <div id="post">
      <!-- Most likely we are going to pass more html here --->
      {{ content|safe }}
    </div>
  {% endblock %}
  </body>
</html>

Generating

To generate a particular site invoke stone with the location of the project’s root folder.

stone root_folder generate

Backends - File

The file backend will write out each file to the specified target path.

Backends - S3

The S3 backend will upload each object to the specified bucket. Currently only html pages are supported, they will be gzipped and have a default caching time of 1 hour.

The minimum required for this backend is:

"backends": [
  {
    "type": "s3",
    "bucket": "example.com",
  }
]

The full range of options is:

"backends": [
  {
    "type": "s3",
    "bucket": "example.com",
    "prefix": "website"
    "cache-controller": "max-age:360",
    # https://tools.ietf.org/html/rfc5646
    "content-language": "en-GB",
    "metadata": {
      "key": "value"
    }
    "tags": {
      "key", "value"
    }
  }
]

Release files for stone-site 0.1.8

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

Source distribution (sdist)

Source distribution for stone-site 0.1.8
File Size Uploaded
stone-site-0.1.8.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stone-site 0.1.8
File Interpreter ABI Platform
stone_site-0.1.8-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 28.4 kB

Release files / stone-site-0.1.8.tar.gz

Download URL stone-site-0.1.8.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
34137af2fdc22fb21c114c8b42e745a444e0d968d75b6b76dca8fa83077c0687
BLAKE2b-256 checksum
How to use checksums
95b64cc4c2a69eadd0bcc879d660dec99c7375b76c4601f0df211cf742e56fdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Release files / stone_site-0.1.8-py2.py3-none-any.whl

Download URL stone_site-0.1.8-py2.py3-none-any.whl
Size 16.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
839360cc04efa95b79137a8cd0008d8a3b21650c45ae4bb050016f380dddc958
BLAKE2b-256 checksum
How to use checksums
30242ec354ac2deaf77d176ed44431c3df3c53e916d7b482ba4982a80a5e2a92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7
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