什么 collections
collections 你可以从字面意思理解为收藏,也可以理解为一个栏目、频道、专题、专栏。
在专栏 collections 下导航可以只包含专栏的页面,或者专栏 collections 的列表页只显示专栏 collections 的内容
以下示例中 collect1 可以改为你自己的命名,当然使用创建多个 collections
在 _config.yml 配置 collections 的通用参数
1
2
3
4
5
6
7
8
9
10
11
12
|
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
---
layout:
---
<a href="../">HOME</a>
{% for my_page in site.collect1 %}
{% if my_page.title %}
<a class="page-link" href="{{ my_page.collect1 | prepend: site.baseurl }}">{{ my_page.title }}</a>
{% 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 %}
<a href="/download/{{ page.slug }}_slides.pdf"
><i class="far fa-file-pdf"></i> Slides</a
> {% endif %}
<a href="/download/{{ page.slug }}.bib"
><i class="far fa-file-alt"></i> BibTex</a
> {% if page.doi %}
<a href="{{ page.doi }}"><i class="fas fa-external-link-alt"></i> DOI</a
> {% endif %}
</p>
</div>
|
内容目录
举例
单个内容
1
2
3
4
5
6
7
8
9
|
---
layout: collect1
title: 内容标题
authors: 内容作者
publication: 什么情况
year: 2019
doi: https://dx.doi.org/XX.XXX/
---
内容正文
|
文件位置:_collect1/
定制列表页
_url/collect1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
---
layout: touch
title: Url 列表
permalink: /collect1/
---
<h1 class="mt-4">Publications</h1>
{% assign publications = site.url | sort: "year" | reverse %}
{% for pub in publications %}
<div class="pubitem">
<div class="pubtitle"><a href="{{ pub.url }}">{{ pub.title }}</a></div>
<div class="pubauthors">{{ pub.authors }}</div>
<div class="pubinfo">{{ pub.publication }}, {{ pub.year}}</div>
<a href="{{pub.url}}"><i class="fas fa-link"></i> Project Page</a>
<hr>
</div>
{% endfor %}
|
转载请注明转自:一极乐( https://yijile.com/log/572/ )
本文采用 CC BY-NC-SA 4.0方式授权。
转载请注明出处和本文链接,说明是否进行修改,不得用于商业用途,使用相同方式共享。