I noticed there is a remove_first
function in liquid. Is it possible to use this to remove the first in an array?
For example:
{% animals = 'animals/cat/dog/bird' | split: '/' | remove_first %}
The above doesn't work, as it seems you're supposed to pass in a substring, like I am with split.
Is there anyway to do this with Jekyll liquid tags?
Use shift
:
{% assign animals = 'animals/cat/dog/bird' | split: '/' | shift %}
{{animals}}
Would give the array:
["cat", "dog", "bird"]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.