Plain apostrophe gets replaced with `’` and output in browser page title

I don’t know if this is new or if I’ve just never noticed it before, and I’ve tried to figure out where this is happening and I’m not entirely sure.

The content itself is authored with a plain/straight apostrophe ' but when published is using a &rsquo; which then cannot be used in the <title> and outputs as the HTML entity string. This is pretty ugly and I’d like to know where this replacement is happening and/or if it can be fixed.

Is this a thing or a theme thing?

edit: no, my textarea OS settings have quote replacements off, so it isn’t happening in my editor

Anybody have anything on this?

It’s a Hugo thing, the default configuration tells the Goldmark Markdown renderer to replace ' with &rsquo;.

This does sound like it might be a theme problem. Do you have an example blog post where it happens?

I have a few, here’s one: Apple Annie’s Microblog

It only appears to be a problem with posts that do not have a proper title, but take that text that becomes the head <title> from the copy.

Thanks! Yeah, I think the theme’s author might be able to apply a fix for that.

I haven’t looked at the details, @Mtt, but it looks like some kind of double escape problem.

Probably need to pass it through to safeHTML

Can you update to the latest version and see if the problem persists? You’re a few minor updates behind.

I try to hold off on that until I have time to deal with regressions with my custom CSS. I’ll try to get that done this weekend and report back on whether that solves the issue.

Thanks for the responses all!

I have updated and the issue persists.

Sorry for late response. Are you perhaps using a custom head.html partial? On my test blog, I used the same text you have and it seems to be working properly for me.

I am not. The only custom template I am using is for layouts/post/single.html to add some of the reply buttons.

Perhaps there is something in there that needs to be updated? I’ve not compared it with the current version in a while.

Can you try rebuilding the site?

Account → View Logs → Rebuild

Basically, I want to see if there is some caching going on in the backend that’s keeping the older posts titles intact. I’m having trouble duplicating the issue, so hoping this is it.

For troubleshooting, here’s a post on your blog with the double escaping present, @Mtt.

Oh, thanks! Looking into it now.

Alright, I’m struggling to figure out why this happening.

I’ve created an exact duplicate blog with the same version of Tiny, same plugins, and a few duplicate posts. It works just fine, without double escaping (or encoding or whatever you want to call it) on the new blog.

The only differences between the two sites, unless I’m completely missing something are:

  1. Custom domain (not working) vs non-custom (working)
  2. Older blog (not working) vs newer blog (working)

But going further than that, here is an old post on an older blog with a custom domain that IS working. And here is a new post on an older blog with a custom domain where it’s not working (and another).

That’s a really long way to say I can’t find any consistency with when it works or doesn’t work properly. Perhaps the solution is to pivot away from adding the summary to the title tag and move to what Marfa Theme does (just the site name on micro posts)?

I’m open to any input, @sod and @manton.

Yes, I’ve rebuilt for other reasons since this issue appeared (or since I noticed it), but it looks like you are onto other investigations so I’ll follow along while the discussion continues. Let me know if there’s anything else I can test out or look at.

I’m in a period where I’m a bit more away from the keyboard than usual, so I can’t explore this myself, but I think I don’t have this problem on my blog. This’s is the snippet I have for titles:

  {{- block "title" . }}{{ if .IsHome }}Home{{ else if .Page.Title }}{{ .Page.Title }}{{ else }}{{ delimit (split .Summary " " | first 5) " " }} …{{ end }} - {{ .Site.Title }}{{- end }}

You could play around with it and compare it to the one you use, @Mtt, and see if you’re able to figure out what causes the double escaping problem that way.

1 Like

I’ve updated Tiny to 2.7.9 with @sod’s snippet. In initial tests, it seems to hold up pretty well. I’m still stumped as to why the old code worked on some blogs but not others. In any case, it seems to be remedied for now.

1 Like

I have updated as well and checked a few posts, might be in the all-clear now. Will update if I find any further weirdness related to this. Otherwise, thanks for the group effort!