~thirdplace/tgen

thirdplace static site generator
refactor
refactor

clone

read-only
https://git.sr.ht/~thirdplace/tgen
read/write
git@git.sr.ht:~thirdplace/tgen

You can also use your local clone with git send-email.

#Thirdplace tgen

Tgen is a static site generator.

#Tutorial

Install: composer require thirdplace/tgen:dev-master

Generate: ./vendor/bin/tgen

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

Browse: http://localhost: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.

Tweak configuration:

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

#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/site/ssg/_site;

    index index.html;

    server_name site.local;

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

#Deploy with scp

scp -r _site site.prod:

#Reference

The configuration:

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

#TODO

Maybe inline markdown dep?