Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: How to use Jekyll category/tag in generated pages? #97

Open
inetbiz opened this issue Mar 9, 2021 · 2 comments
Open
Labels
fixed? Issue fixed, waiting for confirmation question

Comments

@inetbiz
Copy link

inetbiz commented Mar 9, 2021

I am creating a product site. I need to use category/tag pages built into Jekyll. Ideas?

@desirtech
Copy link

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!

@avillafiorita
Copy link
Owner

avillafiorita commented Feb 8, 2022

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 }}

@avillafiorita avillafiorita added fixed? Issue fixed, waiting for confirmation question labels Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed? Issue fixed, waiting for confirmation question
Projects
None yet
Development

No branches or pull requests

3 participants