0

EE 5.2.2

The title meta tag from the default site html-wrapper template is this <meta property="og:title" content="{layout:og_title}">. It is working great for everything except if there's an apostrophe in the title, in which case the output stops before the apostrophe. So the title Love Doesn't Stop is rendered as Love Doesn.

I've tried other options such as using conditionals to pull the {title} from the channel entry itself, which, when I view the page source, renders Love Doesn&#8217;t Stop but still uses Love Doesn when linking out.

I have also tried changing the actual title from Love Doesn't Stop to Love Doesn&#8217;t Stop, but the same thing still happens: I end up with Love Doesn.

Is this an EE problem or an HTML problem?

Thanks.

2 Answers 2

1

Try using the attr_safe modifier on your tag (where the value is generated, not the layout tag) - https://docs.expressionengine.com/latest/templates/variable-modifiers.html#attr_safe - that will convert special characters to HTML entities which should work.

1
  • Thanks for the answer. I did what you suggested. The result was the apostrophe rendered as an HTML entity when I inspect it but it still cut off in the title when the link gets posted. I'm not sure how to proceed with this one.
    – Shayne
    Commented Jul 19, 2019 at 15:22
0

I have the same problem. I also have a similar issue with Channel names where I have to include the unicode character, or the name will be truncated in the layout tag. (But then I still end up with html characters in the title tag).

attr_safe doesn't seem to work consistently and I haven't had any luck trying to use its unicode_punctuation= parameter either.

Did you find anything that worked for you?

1
  • Unfortunately not. I ended up having to go a different rout.
    – Shayne
    Commented Jan 30, 2020 at 17:41

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.