---food: Pizza---<h1>{{ page.food }}</h1>
预定义的变量
- 全局变量: layout, permalink, published
- 帖子变量: date, category, categories, tags
- jekyll-coffeescript
- jekyll-default-layout
- jekyll-gist
- jekyll-github-metadata
- jekyll-optional-front-matter
- jekyll-paginate
- jekyll-readme-index
- jekyll-titles-from-headings
- jekyll-relative-links
代码高亮GitHub Pages 中的代码高亮和 GitHub 是一样的, 默认情况下由 Jekyll 处理代码高亮, Jekyll 使用的代码高亮解析是 Rouge.
页面类型Jekyll 的页面分为不同的类型, 主要有 Page, Posts
PagesPages 用于做单独的页面, 单独创建, 可以放在任意目录, 生成时会放到 _site 目录下
PostsPosts 用于日常的文章发表, 创建时放到 _posts 目录下, 文件名需要使用如下固定的格式
YEAR-MONTH-DAY-title.MARKUP
例如2011-12-31-new-years-eve-is-awesome.md2012-09-12-how-to-write-a-blog.md
每个文章的固定格式如下, 前面的front matter可以为空---layout: posttitle:"Welcome to Jekyll!"---# Welcome**Hello world**, this is my first Jekyll blog post.I hope you like it!
静态文件静态文件例如图片, ZIP, PDF, 可以都放置在 assets 目录下, 再从文章中连接, 例如... which is shown in the screenshot below:
或者链接到PDF... you can [get the PDF](/assets/mydoc.pdf) directly.
文章列表使用以下方式创建文章列表<ul>{% for post in site.posts %}<li><a href="https://www.huyubaike.com/biancheng/{{ post.url }}">{{ post.title }}</a></li>{% endfor %}</ul>
分类和标签Tag 和 Category 都有单数复数的区分, 如果是单数, 后面的整个值都作为一个标签或分类, 如果是复数, 则按空格分隔tag: classic hollywood
会被当成标签"classic hollywood", 如果是tags: classic hollywood
, 则会被当成标签 "classic"和"hollywood".使用tag或category创建文章目录, 可以使用下面的形式, 注意
site.tags
和site.categories
的for循环中, 每个标签或分类会产生两个单元, 一个单元是名称, 另一个单元才是文章列表{% for tag in site.tags %}<h3>{{ tag[0] }}</h3><ul>{% for post in tag[1] %}<li><a href="https://www.huyubaike.com/biancheng/{{ post.url }}">{{ post.title }}</a></li>{% endfor %}</ul>{% endfor %}
分类与标签的区别在与, 分类可以直接由文章的目录路径来定义, 在_post
目录上层的目录, 都会被当成分类, 例如如果文章位于路径 movies/horror/_posts/2019-05-21-bride-of-chucky.markdown, 那么 movies 和 horror a自动成为这个文章的分类.当文章中使用 front matter 定义了类别, 会在列表中添加这篇文章. 取决于 front matter 中是否定义了分类, 例如 category: classic hollywood, 或 categories: classic hollywood, 帖子就会相应地产生这样的链接 movies/horror/classic%20hollywood/2019/05/21/bride-of-chucky.html 或 movies/horror/classic/hollywood/2019/05/21/bride-of-chucky.html
文章摘要通过
excerpt_separator
定义, 例如---excerpt_separator: <!--more-->---Excerpt with multiple paragraphsHere's another paragraph in the excerpt.<!--more-->Out-of-excerpt
在列表中引用摘要<ul>{% for post in site.posts %}<li><a href="https://www.huyubaike.com/biancheng/{{ post.url }}">{{ post.title }}</a>{{ post.excerpt }}</li>{% endfor %}</ul>
草稿草稿可以放到 _drafts 目录下.├── _drafts│└── a-draft-post.md...
Jekyll 实例参考- https://github.com/github/government.github.com
- https://github.com/artsy/artsy.github.io
推荐阅读
- iQOO9Pro和苹果12哪个好-iQOO9Pro和苹果12参数对比
- 小米11拍照对比小米10至尊版_小米11和小米10至尊版拍照哪个好
- 小米12X和小米10S区别-小米12X和小米10S参数对比
- iPhone13和iPhone12外观区别_iPhone13和iPhone12外观一样吗
- 红米k40和小米10s哪个更值得入手-红米k40和小米10s怎么选
- 华为快充66w和40w有什么区别-使用对比
- 天玑1200和天玑1000+有什么区别?天玑1200和天玑1000+对比
- 分辨率和帧率怎么调(抖音分辨率帧率设置)
- 怎么更改照片大小和分辨率
- Java函数式编程:一、函数式接口,lambda表达式和方法引用