【发布时间】:2023-03-21 20:27:01
【问题描述】:
我想为我的 jekyll 网站上的旧博客文章创建一个存档。以前,我的结构在我的网站主页 index.html 上提供_posts 的内容。在在线阅读了集合文档和一些教程之后,我在我的结构中添加了一个集合文件夹_archive,并在里面添加了一个名为test-file.markdown.的测试文件
但是,url mysite.com/archive/test-file 完全重新生成了我的主 index.html,而不是集合内容。
结构:
_archive
index.html
test-file.markdown
_includes
about.html
head.html
... other stuff ...
_layouts
default.html
_posts
post1.markdown
post2.markdown
... other stuff ...
css
img
js
_config.yaml
... other stuff ...
test-file.markdown
---
layout: default
title: test
---
_config.yml
# Site settings
title: test
email: test@test.com
url: http://www.test.com
# Color settings (hex-codes without the leading hash-tag)
color:
primary: ffffff #80B3FF
primary-rgb: "24,288,156" #"128,179,255"
secondary: 2c3e50 #FD6E8A
secondary-dark: 233140 #A2122F
third: 979797
collections:
archive:
output: true
permalink: /archive/:path/
# Build settings
markdown: kramdown
permalink: pretty
mysite.com/archive/index.html
---
---
{% for p in site.archive %}
{{ p}}
{{ p.title }}
{% endfor %}
这会重新渲染主 index.html,而不是 test-file.markdown 的内容。
如何在 mysite.com/archive/正确呈现_archive 的内容?
编辑:将--- 添加到 index.html
【问题讨论】:
标签: jekyll liquid templating