thirdplace / tgen
thirdplace static site generator
v0.0.1
2021-09-21 22:24 UTC
Requires
- php: >=7.3
- ext-json: *
- ext-mbstring: *
- erusev/parsedown: ^1.7
- thirdplace/render: dev-master
This package is auto-updated.
Last update: 2024-04-10 12:29:04 UTC
README
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?