thirdplace 静态站点生成器

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

This package is auto-updated.

Last update: 2024-09-10 13:25:05 UTC


README

Tgen 是一个静态站点生成器。

教程

安装: composer require thirdplace/tgen:dev-master

生成: ./vendor/bin/tgen

预览站点: php -S localhost:8080 -t _site

浏览: https://:8080

./items/2021-09-14-hello-world.md 中创建文章

{
    "title": "Hello World"
}                                                         
         
This is the first post.

./items/about.md 中创建页面

{
    "title": "About"
}                                                         

This is the about page.

调整配置

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

说明

此工具将 ./items 目录中的文件生成静态站点到 ./_site 目录。假设 ./items 目录中的文章和页面使用 markdown 格式,并包含 json 前置信息。

如何操作

隐藏项目

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

This post is only visible by direct url access.

Nginx 配置示例

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 部署

scp -r _site site.prod:

参考

配置

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

待办事项

可能内联 markdown 吗?