
“YiiPress Engine 是一个 基于 Yii3 框架开发的静态网站/博客引擎(Static Website Builder Engine)
composer create-project yiipress/engine myblog
cd myblog
编辑 content/config.yaml 文件:
title: 我的博客
description:一个个人博客
base_url:https://example.com
language:zh-CN
date_format:"Y年m月d日"
entries_per_page:10
permalink:/:collection/:slug/
taxonomies:
-tags
-categories
创建博客集合目录及其配置:
mkdir -p content/blog
创建 content/blog/_collection.yaml:
title: 博客
sort_by: date
sort_direction: desc
feed: true
listing: true
创建文件 content/blog/2026-02-24-hello-world.md:
---
title: "你好,世界"
tags:
- 通用
---
欢迎来到我的博客!这是我的第一篇文章。
## 什么是 YiiPress?
YiiPress 是一款基于 Yii3 构建的静态博客引擎,它具有以下特点:
- 极致速度
- 纯文件驱动(无需数据库)
- 支持插件扩展
创建 content/about.md:
---
title: "关于"
---
这是我的个人博客,我会在这里分享编程相关的文章。
创建 content/navigation.yaml:
main:
-title:首页
url:/
-title:博客
url:/blog/
-title:关于
url:/about/
make yii build
构建完成后,静态 HTML 文件会生成到 output/ 目录:
output/
├──blog/
│ ├──hello-world/
│ │ └──index.html
│ └──index.html
├──about/
│ └──index.html
├──tags/
│ ├──通用/
│ │ └──index.html
│ └──index.html
├──sitemap.xml
└──blog/
├──feed.xml
└──rss.xml
启动开发服务器:
make up
在浏览器中打开 http://localhost:8087(端口可在 docker/.env 中修改)。
开发时包含草稿和未来日期的文章:
make yii build -- --drafts --future
使用多线程加速构建:
make yii build -- --workers=4
强制清理缓存重新构建:
make yii build -- --no-cache
更多:https://github.com/yiipress/engine/tree/master/docs