Skip to main content
edited tags
Link
Matt Stein
  • 4k
  • 3
  • 27
  • 57
Source Link
Marion Newlevant
  • 12.1k
  • 1
  • 23
  • 55

Bullet-proofing tags with punctuation

I have a route set up with a tag: news/tag/[tag] => news/_tag

How do I generate urls that will match that route for all possible tags (including tags with punctuation)?

How do I resolve that url back to a tag (including tags with punctuation)?

Note that twigs url_encode filter href="{{tag.name|url_encode}}" will generate urls that don't route to the template for some tags.