Umbraco invalid link attribute persist on content publish

A lot of our pages are being scored down for W3C checks where they contain links to external urls. This is due to the link markup containing type=“external” which is flagged as an invalid attribute. From playing around in umbraco I see the following behaviour in the tiptap editor:

  • add an internal link to another page - tiptap/umbraco adds type=“document” to the link markup, this does NOT get served in the published html
  • add a link to a media item - tiptap/umbraco adds type=“media”, this does NOT get served in the published html
  • add a link to an external url - tiptap/umbraco adds type=“external”, this DOES get served in the published html

I presume the type attr is some internal mechanism umbraco used to determine how to handle the link, but it appears its not removing the external attr from the published html and serving up a page with invalid markup?

Anyone know a workaround, fix or should I report this as a bug?

Hi @Gavin5656

I’ve looked into this and it looks like a bug.

The type attribute is an internal marker so Umbraco knows whether a localLink points at a document or a media item. It gets stripped on render, but only as a side effect of resolving the localLink, so external links never hit that code path and the attribute survives.

It is worth raising on the tracker: Issues · umbraco/Umbraco-CMS · GitHub

Justin