We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Prevent Antlers / Statamic from escaping HTML attributes

Robin van der Vleuten November 2, 2020 by Robin van der Vleuten

I'm trying to render a navigation section of my site. And I would like to add the aria-current="page" attribute to the current item in the navigation.

  {{ nav:main }}
    <a href="{{ url }}"{{ is_current || is_parent ?= ' aria-current="page"' }}>
      {{ title }}
  {{ /nav:main }}

But this is rendered with an escaped and invalid attribute.

  <a href="/" aria-current=\"page>

How do I prevent Statamic from escaping this attribute?

Answered by Jigal Sanders!
>>>>>>> Answered <<<<<<<
2 Replies