Created
June 29, 2020 08:04
-
-
Save piotrpog/030d0867a400aa6f8f425ec3fc4f7395 to your computer and use it in GitHub Desktop.
Twig macro generating links from array of entries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- macro linkList(entries) -%} | |
{{entries | |
|map(singleElement => "<a href='#{singleElement.url}'>#{singleElement.title}</a>") | |
|join(', ') | |
|raw}} | |
{%- endmacro -%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment