2017 © Pedro Peláez
 

library wright

a static site generator

image

erickmerchant/wright

a static site generator

  • Sunday, July 27, 2014
  • by erickmerchant
  • Repository
  • 1 Watchers
  • 0 Stars
  • 26 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 0 % Grown

The README.md

Wright

A static site generator written in PHP., (*1)

This README is a work in progress, but should serve as the primary documentation for Wright., (*2)

Dependencies

Wright requires PHP 5.5 or greater, and SQLite3 which should be enabled by default in PHP., (*3)

Wright allows relationships between data, so when publishing by first writing everything into SQLite it can stay performant., (*4)

Getting Started

You should check out wright-skeleton for an example of how to set up a site., (*5)

At the bare minimum you'll need the right directory structure, a sitemap settings file, and a template to get started., (*6)

The CLI

Make sure ./vendor/bin/wright is executable. You can symlink it to ./wright. Then run ./wright to get a list of available commands, their arguments and options. Run ./wright [name-of-command] --help to get help with any command., (*7)

Anywhere a directory (also referred to as a collection) or path is called for always include the full path from the current directory. In other words use data/posts/ instead of posts/. This allows you to use tab completion., (*8)

Commands

./wright publish, (*9)

Publishes your site. It looks at settings/sitemap.yml and creates pages based on it, putting them in site/., (*10)

./wright make, (*11)

Used to add a new file to data/., (*12)

./wright move, (*13)

Used to move a file from one place in data to another place. Think of moving a draft from data/drafts/ to data/posts/., (*14)

Directories

base/

The contents of the base directory are copied over to site/ without modification when publishing., (*15)

data/

The data directory is where your content lives. You use ./wright make to add files here and then edit them in your editor of choice., (*16)

settings/

Settings for defaults and your sitemap. (see Settings below), (*17)

templates/

Your templates. Wright uses Twig. Check out its docs to learn more., (*18)

includes/

The includes directory contains PHP files that set extensions, converters, hooks, and middleware. The only thing required is one converter., (*19)

Settings

sitemap.yml

The sitemap settings file tells Wright what pages to create when it publishes your site. It consists of a mapping. Every item is a route with some settings., (*20)

This is a portion of the sitemap from the wright-skeleton, (*21)

/posts/:
    data: posts
    template: posts
/posts/:slug/:
    data: posts/*
    template: post

The first route is straight forward. It tells Wright to grab the data at data/posts.md and feed it to the template called posts. The second route is a bit more complex. posts/* tells Wright to use that route for every post, each entry in the posts directory. For each post :slug will get expanded or replaced with the slug from that post., (*22)

The Versions

18/05 2014

2.0.0

2.0.0.0

a static site generator

  Sources   Download

MIT

The Requires

 

by Erick Merchant