I’m trying to use tags with spaces in my site (e.g. “gordon freeman”). What kirby or my used template (Baltrum) generates is an URL like: /tag:gordon+freeman. Like this, of course, kirby doesn’t find any post, only if it has two tags “gordon” and “freeman”.
Now the system gives me a link like site.tld/tag:gordon freeman
And on the result page it says “Posts tagged with ”gordon%20freeman“”, but still no results.
I guess it must be the built in URL interpreter of kirby.
Could you post your code? I have been using tags with spaces without any problems in the past using urlencode() and urldecode() and with the tagcloud plugin that should work automatically anyway.
Thanks for the info that tags with spaces usually work in kirby!
That brought me to looking into the template files of my applied theme. There the author forgot to use urldecode(). I just added it and now it works fine:
/* Filter by tag, if needed */
if(param('tag', false)) {
$posts = $posts->filterBy('tags', urldecode(param('tag')), ',');
}
I didn’t try rawurlencode().
I have instead create a new clone of a fresh kirby starterkit and tested that categories with spaces do work correctly.
After I rewrote the new installation using my old code. So far it’s working. It must have been some other error that was triggering ERR_TOO_MANY_REDIRECTS.