iero
January 20, 2021, 6:15pm
1
Hello
I would like to show the tags used in a text carousel.
You can see an example in my website , just below the title, in the description part.
I used [https://codepen.io/gschier/pen/jkivt ](this code)
I successfully integrated the JS code, but I’m stuck with the {{tags}} or {{#get ‘tags’}} things.
I would like to replace the static data-rotate=‘[ “tag1”, “tag2.”, “tag3” ]’ part with the real list of tags. And best if I can remove some tags from a static list…
<h1>Tags:
<span
class="txt-rotate"
data-period="2000"
data-rotate='[ "tag1", "tag2.", "tag3" ]'></span>
</h1>
Any idea?
Thanks for your help !
pieter
January 21, 2021, 10:58am
2
Let me get you started
This code gets you a comma separated list of all the tags:
{{#get "tags" limit="all"}}
{{#foreach tags}}
"{{name}}"
{{#unless @last}},{{/unless}}
{{/foreach}}
{{/get}}
iero
January 21, 2021, 5:35pm
3
Thanks a lot @pieter for your help
So if I understand correctly, I need to replace my static array by a call to this code.
I tried many combinaisons, as this one:
<span class="txt-rotate" data-period="2000"
data-rotate=[
{{#get "tags" limit="all"}}
{{#foreach tags}}
"{{name}}"
{{#unless @last}},{{/unless}}
{{/foreach}}
{{/get}}
]>
</span>
It doesn’t work, but I’m pretty sure that I didn’t get something (sorry I’m not fluent in JS)
iero
January 25, 2021, 11:44pm
4
I still don’t understand why this is not working. Because it’s a sort of string and not a list or something like that ?
<span class="txt-rotate" data-period="2000"
data-rotate={{tags separator=", " limit="5"}}>
</span>
Any clue?