Skip to content
Grav 2.0 is officially stable. Read the announcement →
General

How can I replace spaces to hyphen in taxonomies?

Started by Aki 8 years ago · 0 replies · 757 views
8 years ago

Hi, I'd like to replace %20 in taxonomies' url to dash/hyphen.
for example,
mysite.com/blog/tag:apples%20and%20oranges
to
mysite.com/blog/tag:apples-and-oranges

I tried adding | hyphenize onto taxonomylist.html.twig. but it doesn't work.

a class="label label-rounded {{ label_style ?: 'label-secondary' }} p-category" href="{{ blog.url|rtrim('/') }}/tag{{ config.system.param_sep }}{{ tag | hyphenize }}">{{ tag }}</a

actually, url was changed to tag:apples-and-oranges, but when I click the taxonomy label, grav shows no content. But I have some posts with the tag 'apples and oranges'.

I don't want to use hyphened tag name. Tag names have spaces and only urls are hyphened, those are what I want.

Would you please tell me what part of code should I change, please?

Thank you.

Suggested topics

Topic Participants Replies Views Activity
General · by jean-louis67, 3 days ago
2 81 2 days ago
General · by Andy Miller, 7 days ago
0 146 7 days ago
General · by Veehem, 1 week ago
0 146 1 week ago
General · by milkboy, 1 week ago
0 138 1 week ago
General · by ian russell, 2 weeks ago
2 226 2 weeks ago