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
This commit is contained in:
Aaron Sky 2016-03-17 15:32:06 -07:00 committed by Parker Moore
parent ac9a72482d
commit 0c73a6ded9
No known key found for this signature in database
GPG Key ID: 193CDEBA72063C58
1 changed files with 20 additions and 0 deletions

View File

@ -271,6 +271,26 @@ common tasks easier.
</p> </p>
</td> </td>
</tr> </tr>
<tr>
<td>
<p class="name"><strong>Array Filters</strong></p>
<p>Push, pop, shift, and unshift elements from an Array.</p>
</td>
<td class="align-center">
<p>
<code class="filter">{% raw %}{{ page.tags | push: 'Spokane' }}{% endraw %}</code>
<code class="filter">{% raw %}{{ page.tags | pop }}{% endraw %}</code>
<code class="filter">{% raw %}{{ page.tags | shift }}{% endraw %}</code>
<code class="filter">{% raw %}{{ page.tags | unshift }}{% endraw %}</code>
</p>
<p>
<code class="output">['Seattle', 'Tacoma', 'Spokane']</code>
<code class="output">['Seattle', 'Tacoma']</code>
<code class="output">['Seattle']</code>
<code class="output">['Tacoma']</code>
</p>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>