jekyll-datapage_gen
jekyll-datapage_gen copied to clipboard
Documentation: How to use Jekyll category/tag in generated pages?
I am creating a product site. I need to use category/tag pages built into Jekyll. Ideas?
Just dealt with this, try this! (Mind you Page variables like content or title are reserved by Jekyll Layouts object, maybe there should be a _templates dir?)
product.yaml
- id: Soap
template: template
data: The best Soap for Ever Lasting Life!
category: home
tags: on-sale, organic
template.md
---
title: {{ page.id }}
layout: {{ page.template }}
category: {{ page.category }}
tags: {{ page.tags }}
---
# {{ page.id }}
> {{ page.data }}
hope this works!
First of all thanks for the report, thanks to @jeffreydesir for the feedback, and sorry for taking ages before answering your question.
Just to add my two bits, you can also use =page_data_prefix= to prefix the variables and avoid clashes with reserved words.
config.yml
- data: product
page_data_prefix: my
product.yaml
- id: Soap
template: template
data: The best Soap for Ever Lasting Life!
category: home
tags: on-sale, organic
template.md
---
title: {{ page.my.id }}
layout: {{ page.my.template }}
category: {{ page.my.category }}
tags: {{ page.my.tags }}
---
# {{ page.my.id }}
> {{ page.my.data }}