什么 collections
collections 你可以从字面意思理解为收藏,也可以理解为一个栏目、频道、专题、专栏。
在专栏 collections 下导航可以只包含专栏的页面,或者专栏 collections 的列表页只显示专栏 collections 的内容
以下示例中 collect1 可以改为你自己的命名,当然使用创建多个 collections
在 _config.yml 配置 collections 的通用参数
collections:
collect1:
output: true
permalink: /:collection/:name/
defaults:
- scope:
path: ""
type: "collect1"
values: #通用的内容头部信息
layout: collect1
tags:
- 网站收藏
- collections:配置 collections,指定 永久链接 格式,
collect1
表示某一个 collections 这个以你自己明明为准 - scope:关联 collections
- values:通用的内容头部信息,如果内容有重新定义,以内容的为准
单独配置模板(可选)
举例:
文件位置和文件名:_layouts/collect1.html
---
layout:
---
<a href="../">HOME</a>
{% for my_page in site.collect1 %}
{% if my_page.title %}
{{ my_page.title }}
{% endif %}
{% endfor %}
<div class="page">
<h1 class="mt-4 publication-title">{{ page.title }}</h1>
<div class="publication-authors">{{ page.authors }}</div>
<div class="publication-info">{{ page.publication }}, {{ page.year}}</div>
<div class="publication-teaser">
<img
src="/images/publication-pages/{{ page.slug }}.jpg"
alt="project teaser"
/>
</div>
{{ content }}
<h2 id="downloads">Downloads</h2>
<p>
<a href="/download/{{ page.slug }}.pdf"
><i class="far fa-file-pdf"></i> PDF</a
> {% if page.slides %}
Slides {% endif %}
<a href="/download/{{ page.slug }}.bib"
><i class="far fa-file-alt"></i> BibTex</a
> {% if page.doi %}
DOI {% endif %}
</p>
</div>
内容目录
举例
单个内容
---
layout: collect1
title: 内容标题
authors: 内容作者
publication: 什么情况
year: 2019
doi: http://dx.doi.org/XX.XXX/
---
内容正文
文件位置:_collect1/
定制列表页
_url/collect1.html
---
layout: touch
title: Url 列表
permalink: /collect1/
---
<h1 class="mt-4">Publications</h1>
{% assign publications = site.url | sort: "year" | reverse %}
{% for pub in publications %}
{% endfor %}
Relay Tips: 一极乐( https://yijile.com/log/572/ )