Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link tag attributes "data-type" and "data-id" missing #17035

Open
2 of 9 tasks
GrosserRichardUBL opened this issue May 17, 2021 · 4 comments
Open
2 of 9 tasks

Link tag attributes "data-type" and "data-id" missing #17035

GrosserRichardUBL opened this issue May 17, 2021 · 4 comments

Comments

@GrosserRichardUBL
Copy link

  • I've read and understood the contribution guidelines.
  • 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?

  1. Create a page in WordPress named "Foo"
  2. 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)
  3. 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:
@Djennez
Copy link
Member

Djennez commented May 20, 2021

Confirmed and copied to our internal bugtracker at https://yoast.atlassian.net/browse/IM-171

@keithdevon
Copy link

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.

@saulopaiva
Copy link

Hi everyone!

This feature is very important. Does anyone knows a workaround to fix this?

Thanks!

@ElementMedia
Copy link

Hi everyone!

This feature is very important. Does anyone knows a workaround to fix this?

Thanks!

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants