I want to display keywords and description automatically according to the category of the current post. I've used the following code, but it doesn't worked.
{% if page.categories = "category" %}
{% else %}
{% endif %}
But while using {% page.categories %}
it is echoing out the category name correctly. Here are my two doubts:
- How can I compare the current post's category?
- Are
{{ }}
and{% %}
are same here?
It should look like the following:
{% if page.categories == 'some-name' %}
Hei I am in some-name category
{% else %}
No I am not in some-name category
{% endif %}
2.
No,
{{ }} and {% %}
are not the same.{{ }}
is used for echoing stuff, while{% %}
is used for logic expressions and arguments.