Jekyll Feed 插件使用教程
1. 项目的目录结构及介绍
Jekyll Feed 插件的目录结构如下:
jekyll-feed/
├── .github/
│ └── workflows/
├── lib/
├── script/
├── spec/
├── .gitignore
├── .rspec
├── .rubocop.yml
├── .rubocop_todo.yml
├── Gemfile
├── HISTORY.md
├── LICENSE.txt
├── README.md
├── Rakefile
├── appveyor.yml
└── jekyll-feed.gemspec
目录介绍
- .github/workflows: 包含 GitHub Actions 的工作流配置文件。
- lib: 包含插件的核心代码。
- script: 包含一些脚本文件。
- spec: 包含测试文件。
- .gitignore: Git 忽略文件配置。
- .rspec: RSpec 配置文件。
- .rubocop.yml 和 .rubocop_todo.yml: RuboCop 代码风格检查配置文件。
- Gemfile: 依赖管理文件。
- HISTORY.md: 项目更新历史记录。
- LICENSE.txt: 项目许可证。
- README.md: 项目说明文档。
- Rakefile: Rake 任务配置文件。
- appveyor.yml: AppVeyor CI 配置文件。
- jekyll-feed.gemspec: 插件的 gemspec 文件。
2. 项目的启动文件介绍
Jekyll Feed 插件的启动文件主要是 jekyll-feed.gemspec
和 lib
目录下的文件。
jekyll-feed.gemspec
jekyll-feed.gemspec
文件定义了插件的元数据和依赖关系,包括名称、版本、作者、描述、依赖项等。
lib 目录
lib
目录包含了插件的核心代码,其中 feed.xml
是生成 Atom 订阅源的主要文件。
3. 项目的配置文件介绍
Jekyll Feed 插件的配置文件主要是 _config.yml
。
_config.yml
在 _config.yml
中添加以下配置以启用 Jekyll Feed 插件:
plugins:
- jekyll-feed
如果使用的是 Jekyll 3.5.0 之前的版本,请使用 gems
键代替 plugins
:
gems:
- jekyll-feed
可选配置选项
以下是一些可选的配置选项,可以在 _config.yml
中设置:
title: "My awesome site"
description: "Where I blog about Jekyll and other awesome things"
url: "https://example.com"
author: "Your Name"
feed:
categories:
- news
- updates
posts_limit: 20
这些配置选项将影响生成的 Atom 订阅源的内容和格式。