Array filters are NON-DESTRUCTIVE
Inspect page tags
{{ page.tags | inspect }}
Should render: [“Seattle”, “Tacoma”]
Render: ["Seattle", "Tacoma"]
Add as last.
{{ page.tags | push: 'Spokane' | inspect }}
Should render: [‘Seattle’, ‘Tacoma’, ‘Spokane’]
Render: ["Seattle", "Tacoma", "Spokane"]
Take the first.
{{ page.tags | pop | inspect }}
Should render: [‘Seattle’]
Render: ["Seattle"]
Take the last.
{{ page.tags | shift | inspect }}
from ["Seattle", "Tacoma"]
Should render: [‘Tacoma’]
Render: ["Tacoma"]
Add as first.
{{ page.tags | unshift: "Olympia" | inspect }}
Should render: [‘Olympia’, ‘Seattle’, ‘Tacoma’]
Render: ["Olympia", "Seattle", "Tacoma"]
ef6d1ee13f6ff4fb52d41d4fd9293f3161cc3c04