Issue with template names that include an em dash (–)

Hi there,

I am experiencing a recurring issue where the template slug gets malformed, and this breaks the call to the template. E.g. section-%e2%80%93-posts

It seems that UTF-8 coding is added to the template slug when an em dash (—) is in the template name, but I don’t use this dash type.

For example, a template named Section – Posts will save the slug like this:

Slug: section-%e2%80%93-posts

The issue seems random, and I am unsure how to recreate it without manually inserting an em dash, but it may have something to do with the use of em dashes in the Templates list.


Today it happened after creating some template categories.


I’m not seeing anything that’s working unexpectedly in my testing, so maybe you can clarify where the problem is. From what I’m seeing, it looks like an em dash is a special character so it’s not a valid character to have in a template name. That means that when you put an em dash in your template title like Section – Posts it gets converted into a string of valid characters like section-%e2%80%93-posts. The options I see would be to either:

  1. Work as you normally would and use the auto-generated template name to refer to it, like <Template name="section-%e2%80%93-posts" />
  2. Don’t use em dashes in your template name
  3. Instead of relying on the automatically generated template name that might be a bit ugly because of the em dash you’ve got in the template title, modify the name to something more legible like section-posts and update the template.

Let me know if that makes sense or if I’m missing something about the issue you’re describing.

@benjamin I’ve seen this issue elsewhere with the entire editor content being affected. Definitely worth flagging as a bug. I’ll send you a link to an affected site (up until now it’s only been happening on local installs)

@Rips We looked into the issue Julia was describing it seems that when you check the “Disable the visual editor when writing” checkbox on your user profile, weird things happen when saving in the L&L template editor. But I don’t think that’s related to the issue you’re describing with template names/slugs. Let me know if my answer above makes sense or if there’s some other bug going on.

Hi Ben,

I am not really sure how these EM dashes find their way into my template names. It could have been a mistake while copying and pasting names or something.

I think what is going wrong here is that EM dashes are not being processed correctly by L&L when saving the template.

When I save a template with title Section – Posts the slug becomes section-%e2%80%93-posts, but the includes Hex UTF-8 code which causes problems.

It would be better if L&L handled an EM dash the same way a WP post does:

This would ensure that references to template names in the logic do not break.

1 Like