wordpress-seo
wordpress-seo copied to clipboard
Link tag attributes "data-type" and "data-id" missing
- [X] I've read and understood the contribution guidelines.
- [X] I've searched for any related issues and avoided creating a duplicate issue.
Please give us a description of what happened.
When we add an internal link to a wordpress page inline (see https://wordpress.com/support/links/#method-one-the-link-button, second gif), the generated html tag has no attributes data-type="page" and data-id="<id>" with Yoast SEO activated.
Please describe what you expected to happen and why.
The html tag for the link has the attributes data-type="page" and data-id="<id>", because this is WordPress default. Having the attributes attached is crucial when using the rest api in a consuming application. E.g. in a single page application, such a link has to be modified to trigger a callback function that is fetching the content of the linked page instead of including the link as is. Without the information, that the link is a link to an internal page with a known id, it is hard to decide for the spa how to handle it. Corresponding support topic: https://wordpress.org/support/topic/link-tag-attributes-missing/
How can we reproduce this behavior?
- Create a page in WordPress named "Foo"
- Create another page "Bar" in the same WordPress instance with a text block in it and insert a link to the page "Foo" by using the page link selection in the editor (see https://wordpress.com/support/links/#method-one-the-link-button, second gif)
- Look at the html of the page "Bar" in the frontend: the link tag to "Foo" has the attributes data-type and data-id in it, when Yoast SEO was deactivated while creating the link (= WordPress default) and the attributes are missing, when Yoast SEO was activated.
Technical info
- If relevant, which editor is affected (or editors):
- [ ] Classic Editor
- [ ] Gutenberg
- [ ] Classic Editor plugin
- Which browser is affected (or browsers):
- [ ] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Other
Used versions
- WordPress version:
- Yoast SEO version:
- Gutenberg plugin version:
- Classic Editor plugin version:
- Relevant plugins in case of a bug:
- Tested with theme:
Confirmed and copied to our internal bugtracker at https://yoast.atlassian.net/browse/IM-171
Hey all!
I'd love to see a fix for this. I'm using the data-id attribute to check if the link is to the current page so that I can apply a 'current-page' class with JS.
This bug completely breaks that functionality.
Hi everyone!
This feature is very important. Does anyone knows a workaround to fix this?
Thanks!
Hi everyone!
This feature is very important. Does anyone knows a workaround to fix this?
Thanks!
+1
Any news on this?
Hi @Tropicalista
I discussed this with our development team, who informed me that this issue will be selected for future sprints. Our developers work on the highest priority issues first. So, we cannot give you an estimate of when they'll start working on the issue.