From 0c73a6ded99170008ded32fd3c0896c91c6caec7 Mon Sep 17 00:00:00 2001
From: Aaron Sky
Date: Thu, 17 Mar 2016 15:32:06 -0700
Subject: [PATCH] Update Templates Docs to include Array Filters
PR #2895 merged this in, but there isn't any documentation anywhere for this as far as I can find. All the Stack Overflow answers I could find said it was impossible to push and pop elements from a Liquid array, although that's probably because they were using Shopify's Liquid.
Fixes https://github.com/jekyll/jekyll/pull/4384
---
site/_docs/templates.md | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/site/_docs/templates.md b/site/_docs/templates.md
index 0ebd35f8..ecb1c110 100644
--- a/site/_docs/templates.md
+++ b/site/_docs/templates.md
@@ -271,6 +271,26 @@ common tasks easier.
+
+
+ Array Filters
+ Push, pop, shift, and unshift elements from an Array.
+ |
+
+
+ {% raw %}{{ page.tags | push: 'Spokane' }}{% endraw %}
+ {% raw %}{{ page.tags | pop }}{% endraw %}
+ {% raw %}{{ page.tags | shift }}{% endraw %}
+ {% raw %}{{ page.tags | unshift }}{% endraw %}
+
+
+ ['Seattle', 'Tacoma', 'Spokane']
+ ['Seattle', 'Tacoma']
+ ['Seattle']
+ ['Tacoma']
+
+ |
+