博客文章模板和创建指南
文章目录结构
每个专题下的文章应该放在对应的目录中:
posts/
├── life/ # 生活与个人
│ └── your-post-name/ # 文章目录(使用小写字母和连字符)
│ └── index.qmd # 文章内容
├── electronics/ # 电子产品与软件
│ └── your-post-name/
│ └── index.qmd
└── research/
├── experiments/ # 实验笔记
│ └── your-post-name/
│ └── index.qmd
├── papers/ # 文献阅读
│ └── your-post-name/
│ └── index.qmd
├── bioinformatics/ # 生物信息学
│ └── your-post-name/
│ └── index.qmd
└── opinions/ # 研究观点
└── your-post-name/
└── index.qmd
创建新文章的步骤
1. 选择专题目录
根据文章内容选择对应的专题目录: - 生活与个人 → posts/life/ - 电子产品与软件 → posts/electronics/ - 实验笔记 → posts/research/experiments/ - 文献阅读 → posts/research/papers/ - 生物信息学 → posts/research/bioinformatics/ - 研究观点 → posts/research/opinions/
2. 创建文章目录和文件
# 例如:在 bioinformatics 专题下创建新文章
mkdir -p posts/research/bioinformatics/my-first-analysis
touch posts/research/bioinformatics/my-first-analysis/index.qmd3. 文章模板
复制以下模板到 index.qmd:
---
title: "文章标题"
description: "文章简短描述,会显示在列表和 RSS feed 中"
author: "Shi Qianchuan"
date: YYYY-MM-DD
categories:
- Research # 主要分类(Research, Life, Electronics)
- Bioinformatics # 子分类(会显示为标签)
draft: false # false = 发布,true = 草稿(不会显示)
---
## 引言
文章的开头部分...
## 主要内容
### 子标题
文章正文...
## 结论
总结...4. 重要字段说明
必需字段:
- title: 文章标题
- date: 发布日期(格式:
YYYY-MM-DD或YYYY-MM-DD HH:MM) - draft:
false表示发布,true表示草稿(不会显示在列表中)
推荐字段:
- description: 文章描述(显示在列表和 RSS feed 中)
- author: 作者名称
- categories: 分类标签(至少一个,会显示为标签)
categories 说明:
- 第一个分类应该是主要分类:
Research,Life, 或Electronics - 后续分类是子分类/标签,例如:
Bioinformatics,Paper Reading,Experimental Notes等 - 这些标签会出现在:
- Blog 页面的标签过滤下拉菜单
- 文章卡片上的标签显示
- RSS feed 中
5. 示例文章
示例 1:生物信息学文章
---
title: "DNA Methylation Analysis Pipeline"
description: "A comprehensive guide to analyzing DNA methylation data using R and Bioconductor"
author: "Shi Qianchuan"
date: 2025-01-21
categories:
- Research
- Bioinformatics
draft: false
---
## Introduction
This post describes my workflow for analyzing DNA methylation data...示例 2:文献阅读
---
title: "Review: Epigenetic Mechanisms in Cancer"
description: "Summary and thoughts on recent advances in cancer epigenetics"
author: "Shi Qianchuan"
date: 2025-01-22
categories:
- Research
- Paper Reading
draft: false
---
## Paper Summary
This paper investigates...示例 3:生活分享
---
title: "My Journey into Bioinformatics"
description: "Personal reflections on learning computational biology"
author: "Shi Qianchuan"
date: 2025-01-23
categories:
- Life
draft: false
---
## Getting Started
When I first started learning bioinformatics...验证文章
创建文章后,运行以下命令验证:
# 渲染整个网站
quarto render
# 或者只渲染特定文章
quarto render posts/research/bioinformatics/your-post-name/index.qmd
# 预览网站
quarto preview检查清单
创建文章后,确保: - [ ] 文章有 date 字段 - [ ] draft: false(如果要发布) - [ ] 至少有一个 categories 标签 - [ ] 文章目录名称使用小写字母和连字符(如 my-post-name) - [ ] 文章文件名为 index.qmd(放在文章目录内)
常见问题
Q: 文章没有显示在 Blog 页面?
A: 检查: 1. draft: false 已设置 2. 有有效的 date 字段 3. 运行了 quarto render
Q: 标签没有出现在过滤菜单中?
A: 确保 categories 字段包含至少一个标签,并且文章已渲染。
Q: 如何创建草稿?
A: 设置 draft: true,文章将不会显示在列表中,但可以通过直接链接访问。
Q: 文章应该放在哪个目录?
A: 根据内容选择对应的专题目录。如果不确定,可以放在最相关的目录,或者创建后可以移动。