which list tags like this: “tag1, tag2, tag3”.
For building a Twitter Intent link I need to remove the spaces so that the output looks like this: “tag1,tag2,tag3”.
How can I achieve that?
The source field for tags is defined as this:
Then in your blueprint: {{ page.tags.removeSpaces }}.
The code converts the field value to an array with split() and then joins the pieces again with a comma.
The alternative would be the PHP variant to what @jimbobrjames posted above, but that would also remove whitespace from multi-word tags, therefore the above is more reliable (or the pattern would have to be extended).
Great Sonja, thanks a lot!
Without you working with Kirby (as a beginner) would be only half the fun!
Regarding Kirby Query Language: isn’t that the right term for the official core implementation of those variables? Query Language | Kirby CMS