I’ve been getting a warning show up (not sure when this started, as I’ve had a long break from this blog.
This is the warning:
Liquid Warning: Liquid syntax error (line 26): Unexpected character { in "post.categories contains {{category}}" in /_layouts/categories.html
and this is the code
--
title: Categories
layout: categories
---
<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: "en" }}">
{%- include head.html -%}
<body>
{%- include header.html -%}
<main class="page-content" aria-label="Content">
<div class="wrapper">
<div class="home">
{%- if page.title -%}
<h4 class="page-heading">{{ page.title }}</h4>
{%- endif -%}
<p>
{%- for category in site.categories -%}
<a href="{{category.title | downcase}}.html">{{ category.title }}</a> | 
{%- endfor -%}
</p>
<!-- This variable is needed for the comparison -->
{% assign category = page.title|downcase %}
<!-- Now we can loop through -->
{% for post in site.posts %}
{% if post.categories contains {{category}} %}
<li><a href="{{post.url}}">{{ post.title }}</a></li>
{% endif %}
{% endfor %}
{%- if site.posts.size > 0 -%}
<h4 class="post-list-heading">{{ page.list_title }}</h4>
<ul class="post-list">
{%- for post in paginator.posts -%}
<li>
{%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
<span class="post-meta">{{ post.date | date: date_format }}</span>
<h5>
<a class="post-link" href="{{ post.url | relative_url }}">
{{ post.title | escape }}
{{ post.category }}
</a>
</h5>
{%- if site.show_excerpts -%}
{{ post.excerpt }}
{%- endif -%}
</li>
{%- endfor -%}
</ul>
<p class="rss-subscribe">subscribe <a href="{{ "/feed.xml" | relative_url }}">via RSS</></p>
{%- endif -%}
</div>
</div>
</main>
{%- include footer.html -%}
</body>
</html>