user10204688
user10204688

Reputation: 95

Jekyll site posts and liquid command concat error

I have trouble with array in liquid. And even no hint to solve this problem. Main point is that I want to make list of post. I just guess it us problem of array and string.

This is error file

Liquid Exception: Liquid error (line 7): concat filter requires an array argument in _pages/references.html
jekyll 3.7.4 | Error:  Liquid error (line 7): concat filter requires an array argument

This is front matter

---
big-title: "JS"
middle-title: "JavaScript Window and DOM BOM"
small-title: "8" 
field:
  - javascript
relate:
  - javascript
toc: true
toc-head-level-choice: false
#do this if head level choice is true
# toc-head-max:
# toc-head-min:
---

This is liquid file

---
layout: page
title: References
permalink: /documents/
---
<h1>References table</h1>

{% assign big_subject = "" | split: "" %}
{% assign middle_subject = "" | split: "" %}

{% for post in site.posts %}
  {% assign big_subject= big_subject | concat: post.big-title %}
  {% assign middle_subject= middle_subject | concat: post.middle-title %}
{% endfor %}

Upvotes: 0

Views: 366

Answers (1)

David Jacquel
David Jacquel

Reputation: 52829

You can use push or shift jekyll filters to add an element to an array.

{% assign big_subject= big_subject | push: post.big-title %}

Upvotes: 1

Related Questions