Skip to main content

A simple and minimal static site generator.

Project description

vite

A simple and mnml static site generator that Just Works™

Vite demo

Installation

$ pip install vite

Usage

$ vite init path/to/project
$ vite new blog/some-post.md   # `pages/` is implied

This creates pages/blog/some-post.md.

And then:

$ vite build   # in project directory

Rendered HTML will be in the build directory.

Finally, run:

$ vite serve  # also in the project directory

Configuration

Not very sophisticated, but basic configuration can be acheived using config.py found in the project directory. Example config:

# config.py 
title = ''
author = ''
header = ''
footer = '' 
template = 'index.html'  # default is templates/index.html
post_build = []          # list of commands to run post-build

Templating

Vite uses Jinja2 templating, so template files must be placed in a separate templates/ directory.
A basic example would be:

<link rel="stylesheet" href="/static/sakura-earthy.css">

<title> {{ title }} </title>

<body>
{{ body }}
</body>

<footer>
{{ footer }}
</footer>

Specifying per-page templates

Vite allows for specifying a unique template, per page. This is acheived by including YAML frontmatter at the top of the Markdown file, like so:

---
template: foo.html
title: Some fancy buzzwords here
subtitle: Cool catch phrase here
date: 2019-08-09
---

## markdown here
...

Notes on templating

  • Stylesheets, images and JS can be accessed from the static folder.
  • index.html, i.e. your website's homepage, should be _index.md in the pages/ directory.

Directory tree

example
├── build
├── config.py
├── pages
│   └── test.md
├── static
└── templates
    └── index.html

TODO

  • <input type="checkbox" checked="" disabled="" /> Templating
  • <input type="checkbox" checked="" disabled="" /> CSS support
  • <input type="checkbox" checked="" disabled="" /> Implement a simple HTTP server (later)
  • <input type="checkbox" checked="" disabled="" /> Add example site
  • <input type="checkbox" checked="" disabled="" /> Basic config (config.py)
  • <input type="checkbox" checked="" disabled="" /> Parsing frontmatter (JSON, YAML, TOML) for per-page options
  • <input type="checkbox" checked="" disabled="" /> Better support for home page (main index.html page)
  • <input type="checkbox" checked="" disabled="" /> More powerful frontmatter (title, date, draft status, etc.) (draft status is incomplete)
  • <input type="checkbox" disabled="" /> Deeper directories under pages/ (supports only one level now, breaks otherwise) (not happening)
  • <input type="checkbox" disabled="" /> Tagging system (not happening)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for vite, version 1.5.2
Filename, size File type Python version Upload date Hashes
Filename, size vite-1.5.2.linux-x86_64.tar.gz (8.8 kB) File type Source Python version None Upload date Hashes View
Filename, size vite-1.5.2-py3-none-any.whl (6.5 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page