foo
refactor
refactor
Tgen is a static site generator.
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
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.
{
"title": "Hidden post",
"hidden": true
}
This post is only visible by direct url access.
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;
}
}
scp -r _site site.prod:
The configuration:
[
'title' => 'Thirdplace',
'description' => 'This is the description of the site',
'base_url' => 'http://localhost:8080',
'items' => './items',
'site' => './_site',
'clean_urls' => false,
];
Maybe inline markdown dep?