ordinalm/gyokuto
Composer 安装命令:
composer require ordinalm/gyokuto
包简介
A static site generator module, using PHP, Markdown, and Twig.
README 文档
README
Overview
Gyokuto uses PHP and Twig to render local Markdown content to produce a static site. It can be used as is, or combined with other PHP modules.
Installation
Composer (recommended)
In your project, install the module with:
composer require ordinalm/gyokuto dev-master
Page rendering
Start a build with:
vendor/ordinalm/gyokuto/bin/build
By default, this will look for content in ./content and output to ./www, reading config from ./gyokuto.yml.
Use -o /path/to/config/YOUR_CONFIG_FILE.yml to use a different config file on startup.
Use -v1 for verbose output.
Markdown page structure
Gyokuto will process flat Markdown files without metadata with no problems, but you may wish to include metadata using the Multimarkdown page header system.
---
title: About this site
date: 2020-10-18 13:30
header: true
---
Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Curabitur
blandit tempus porttitor. Maecenas faucibus mollis interdum. Cras justo
odio, dapibus ac facilisis in, egestas eget quam.
Markdown headers are parsed as YAML data and are then available to Twig templates.
You may also include Twig code within page content - e.g.
---
foo: bar
---
The value of "foo" is "{{ current_page.meta.foo }}".
will render as
The value of "foo" is "bar".
See below for the values that are automatically available to Twig.
Special metadata variables
The following metadata variables have special meaning to Gyokuto.
draft- if set to a value evaluating totrue, this page will not be copied over or included in any page lists or indexes.template- this determines the template used to process this page. If not set, the value isdefault.twig.path- if set, the page will be output to this path relative to the root of the output directory. This can also change the file extension e.g.path: "sitemap.xml"hidden- if set to a value evaluating totrue, the page will be created in output, but won't be included in the indexing process, so will not appear in eitherindexorpageslists (see Twig variables, below).
Build process
Compile phase
All files in the content directory are marked as either parsable (.md or .markdown extension) or to simply be copied.
All parseable files are parsed, their metadata included in the overall page list, and, if appropriate, the metadata used to construct indexes.
Build phase
Non-parsable files are simply copied unchanged to the same filename in the output directory. These can be of any type - images, CSS, PHP code etc.
Markdown files are parsed with the following steps:
- All Twig code in the page body is evaluated.
- The page body is converted into HTML from Markdown.
- The chosen Twig template for that page, as defined in the
templatemetadata value, is run.
Twig variables available during rendering
current_page- the page being rendered nowmetatitle- an unescaped string, taken either from thetitleMarkdown header field or from the filenamedate- a UNIX timestamp taken either from thedatefield in the Markdown header- any other variables set in the page's Markdown header
path- from site root, beginning with/content- processed HTML from page Markdown body (not available within pages)
pages- all pages in the build, keyed by path, in descending order ofdate, do not includecontent. Can be used to look up page metadata referred to in indexes.metatitledate
path
config- all values declared in the config file
If any metadata fields have been specified for indexing using the index value in the config file, they will appear as:
index- keyed by the meta variable being indexed, sorted by the value of that variable- key 1
- path 1
- path 2
- ...
- key 2
- path 3
- ... ...
- key 1
The paths can be used to look up page metadata in the pages list.
Example: list of all pages by tag
In gyokuto.yml:
index: [ "tags" ]
In a page or template:
{% for tag, pagelist in index.tags %}
<h3>{{ tag|escape }}</h3>
<ul>
{% for path in pagelist %}
<li><a href="{{ path }}">{{ pages[path].meta.title|escape }}</a></li>
{% endfor %}
</ul>
{% endfor %}
ordinalm/gyokuto 适用场景与选型建议
ordinalm/gyokuto 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ordinalm/gyokuto 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ordinalm/gyokuto 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-29