thirdplace static site generator

v0.0.1 2021-09-21 22:24 UTC

This package is auto-updated.

Last update: 2025-06-05 18:23:08 UTC


README

Tgen is a static site generator.

Tutorial

Install: composer require thirdplace/tgen:dev-master

Copy over the default config:

cp vendor/thirdplace/tgen/config.php.dist ./config.php

Generate: ./vendor/bin/tgen ./config.php

Preview site: php -S 127.0.0.1:8080 -t _site

Browse: http://127.0.0.1:8080

Create a post in ./items/2021-09-14-hello-world.md:

{
    "title": "Hello World"
}

This is the first post.

Create a page in ./items/about.md:

{
    "title": "About"
}

This is the about page.

Explanation

This tool generates a static site from the files in ./items into ./_site. The posts and pages in ./items are assumed to be in markdown and to have a json front matter.

How-to

Hide an item

{
    "title": "Hidden post",
    "hidden": true
}

This post is only visible by direct url access.

Nginx example configuration

server {
    listen 80;

    root /home/alice/blog/_site;

    index index.html;

    server_name example.com;

    location / {
        error_page 404 /404.html;
        try_files $uri $uri.html $uri/ =404;
    }
}

Deploy with scp

scp -r _site example.com:

Reference

The configuration:

[
    'title'         => 'Thirdplace',
    'description'   => 'This is the description of the site',
    'base_url'      => 'http://27.0.0.1:8080',
    'items'         => './items',
    'site'          => './_site',
    'clean_urls'    => false,
];