Jekyll Liquid question for my tag page if anyone can help. What is "dotdot"?! Jekyll builds fine but leaves a bugging syntax error.
Liquid Warning: Liquid syntax error (line 2): Expected dotdot but found pipe in "{{(site.tags | sort:0) for tag in sorted_tags }}" in tags.htmlLiquid Warning: Liquid syntax error (line 9): Expected dotdot but found pipe in "{{(site.tags | sort:0) for tag in sorted_tags }}" in tags.html
---
title: Tags
permalink: /tags/
layout: page
excerpt: Sorted article by tags.
---
<div class="archive-tags">
{% assign sorted_tags = (site.tags | sort:0) for tag in sorted_tags %}
{% for tag in sorted_tags %}
{% capture name %}{{ tag | first }}{% endcapture %}
<a class="tag-item" href="#{{name}}">{{ name }}</a>
{%- endfor -%}
</div>
{% assign sorted_tags = (site.tags | sort:0) for tag in sorted_tags %}
{% for tag in sorted_tags %}
{%- capture name -%}{{ tag | first }}{%- endcapture -%}
<h2 id="{{ name }}">{{ name | upcase }}</h2>
{%- for post in site.tags[name] -%}
<article class="post-item" id="results-container">
<span class="post-item-date">{{ post.date | date: "%b %d, %Y" }}</span>
<h3 class="post-item-title">
<a href="{{ post.url }}">{{ post.title | escape }}</a>
</h3>
</article>
{%- endfor -%}
{%- endfor -%}
Feel i'm close to a solution with Jekyll building. Simply can not find a solution to clear the syntax error.
I think it doesn't work as {% endfor %}
is missing.
Try removing the for loop part from your sorted_tags assignment.
A value of 0 for the sort parameter indicates that the elements should be in reverse order. Without 0, it sorts in ascending order.
The assignment should work; it sorts all the tags in reverse order and assigns them to a new variable called sorted_tags.
You use the variable in the next line to loop over the reversed sorted tags anyway.
<div class="archive-tags">
{% assign sorted_tags = site.tags | sort:0 %}
{% for tag in sorted_tags %}
{% capture name %}{{ tag | first }}{% endcapture %}
<a class="tag-item" href="#{{name}}">{{ name }}</a>
{%- endfor -%}
</div>
{% assign sorted_tags = site.tags | sort:0 %}
{% for tag in sorted_tags %}
{%- capture name -%}{{ tag | first }}{%- endcapture -%}
<h2 id="{{ name }}">{{ name | upcase }}</h2>
{%- for post in site.tags[name] -%}
<article class="post-item" id="results-container">
<span class="post-item-date">{{ post.date | date: "%b %d, %Y" }}</span>
<h3 class="post-item-title">
<a href="{{ post.url }}">{{ post.title | escape }}</a>
</h3>
</article>
{%- endfor -%}
{%- endfor -%}