1

Anyone have an idea on how to incorporate a service mark (SM) into the title of an entry? I've tried just doing SM, tried the code for SM & # 8 4 8 0 ; (without the spaces), and nothing works. I even tried creating a new rich text field so I could do it there and have a conditional to show that field instead of the title field, but that makes it so that it can't be used in different headline tags on different pages, as its auto-enclosed into a pargraph or h3 or whatever.

Any thoughts or ideas are greatly appreciated!!

1 Answer 1

2

I think the issue is that craft will sanitise (escape) any code before it goes into the database, to prevent any code injection and twig will also do the same at a template level (to prevent script injection).

If you have your entry title as DIVA! Becomes Famous &#8480 for example, it will appear like that in craft and in your templates, but if you do {{ entry.title|raw }} it will actually output ℠ in your template.

From the twig docs:

The raw filter marks the value as being "safe", which means that in an environment with automatic escaping enabled this variable will not be escaped if raw is the last filter applied to it

See more in twig docs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.