| title | PPage 初始化指南 | |||
|---|---|---|---|---|
| id | init-guide | |||
| type | page | |||
| collection | tutorials | |||
| parent | basic-index | |||
| order | 2 | |||
| date | 2025-12-31 | |||
| author | System | |||
| tags |
|
|||
| category | 教程 |
ppage init 命令用于初始化 PPage 项目,将示例模板归档并创建一个干净的、指引性的配置环境。
git clone https://github.com/yourusername/ppage.git
cd ppage
npm installnpm run init或者如果全局安装了 ppage:
ppage init命令会自动将当前的示例模板文件归档到 _template/ 目录:
_template/
├── content/ # 原始示例内容
│ ├── posts/
│ ├── pages/
│ └── files/
└── public-config.yml # 原始 public 配置文件
注意: _template/ 目录保存了完整的示例,你可以随时参考。
在 content/ 目录下创建指引性的模板文件:
content/
├── posts/
│ └── welcome.md # 欢迎文章模板
├── pages/
│ └── about.md # 关于页面模板
└── files/
├── pdfs/ # PDF 文件目录
└── README.md # 使用说明
生成带有详细注释的配置文件:
public/config.yml- 配置文件(唯一配置文件)
配置文件中所有需要填写的地方都标注了 【请填写】 标记。
初始化完成后,请按以下步骤配置:
打开 public/config.yml,搜索 【请填写】 标记,填写你的信息:
# 站点基本信息
site:
title: '【请填写】你的网站标题'
description: '【请填写】网站描述'
author: '【请填写】你的名字'
# 个人信息
profile:
name: '【请填写】你的名字'
email: '【请填写】your.email@example.com'
# ...- 博客文章: 在
content/posts/目录下创建 Markdown 文件 - 页面内容: 在
content/pages/目录下创建 Markdown 文件 - 文件资源: 将 PDF 等文件放在
content/files/目录下
npm run dev打开浏览器访问 http://localhost:5173 查看效果。
初始化后的目录结构:
ppage/
├── _template/ # 归档的原始模板(供参考)
├── content/ # 你的内容目录
│ ├── posts/ # 博客文章
│ ├── pages/ # 页面内容
│ └── files/ # 文件资源
├── public/ # 静态资源
│ ├── assets/ # 图片、图标等
│ └── config.yml # 配置文件(会在构建时使用)
├── src/ # 源代码
├── scripts/ # 脚本工具
│ └── init.js # 初始化脚本
└── package.json
A: 原始示例已保存在 _template/ 目录中,你可以:
# 复制回原始内容
cp -r _template/content/* content/
cp _template/public-config.yml public/config.ymlA: 可以,但要注意:
- 再次运行会覆盖当前的
content/和配置文件 - 建议在运行前备份你已编辑的内容
_template/目录会被更新为当前内容的备份
A: 在 content/posts/ 目录下创建新的 Markdown 文件:
---
title: '文章标题'
date: '2025-12-31'
description: '文章描述'
tags:
- '标签1'
- '标签2'
---
# 文章内容
在这里写你的内容...A:
- 将文件放在
content/files/目录下(如content/files/pdfs/my-paper.pdf) - 在 Markdown 中引用:
[下载论文](/content/files/pdfs/my-paper.pdf) - 系统会自动扫描并在文件页面展示
- 📖 查看 用户使用指南 了解详细使用说明
- 🎨 编辑
public/config.yml自定义网站外观 - ✍️ 开始在
content/posts/目录下创作你的第一篇文章 - 🚀 准备好后运行
npm run build构建生产版本
如果遇到问题,请:
- 查看 用户使用指南
- 参考
_template/目录中的示例 - 在 GitHub 上提交 Issue
祝你使用愉快!🎉