I have a variable in the mainpage.html front matter that is:
categories:
- name: xxx
title: yyy
tag: sports
- name: aaa
title: bbb
tag: ccc
in _posts front matter I have:
category: xxx
in _include/card I want to make an if statement like this:
{% if site.data.categories.name === posts.category %}
{{ site.data.categories.tag }}
{% endif %}
output: sports
How can I do this? I’m not sure how I can reach a variable that is in the mainpage.html located in the root directory when I want the output to be in _include/card.