-
Notifications
You must be signed in to change notification settings - Fork 800
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
Publicize: add Fediverse meta tag on posts when available #38198
Conversation
adc154d
to
03de30c
Compare
See https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/ If we have an existing Mastodon connection on the site, let's add it as meta tag on each post.
03de30c
to
3d8b063
Compare
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Social plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
This looks good. Thanks for working on it @jeherve! It's an edge case, but what should we do when there is more than one Mastodon connection? This change will pick the first, but that could be a shared connection from another author on the site. We could check that the connection is owned by the author of the post, but they might not want to promote the post on that account. Perhaps we live with that for now, as it will be a rare occurrence, and we can tackle it when we look at meta tags in general? We currently have similar problems with picking OpenGraph images and conflicts with SEO plugins. |
Yes, this was my concern as well, as per my question in the PR description.
I'd be okay with that but wanted y'all to make the call.
Is that something that's on the Reach roadmap? |
I can't say something about the shared connection case (I have not yet looked into the code), but it is possible to add multiple accounts. For now Mastodon will pick the first one, but they think about supporting multiple in the future.
|
Hi @jeherve! I just found the time to review this, my apologies for jumping in on this late. In the proposed change, we are picking the first connection that's either owned by the author or a connection that's shared. In a subsequent iteration, even if a connection is shared, we could add a flag to determine whether a shared connection was created by the author. If yes, we could add the tags in that case as well. This is the line fbhepr%2Skers%2Sjcpbz%2Sjc%2Qpbagrag%2Snqzva%2Qcyhtvaf%2Schoyvpvmr%2Schoyvpvmr%2Qjcpbz.cuc%3Se%3Q8681o875%26sv%3Qtrg_nyy_pbaarpgvbaf_sbe_oybt_vq%232134-og that populates the connection data. The @reach-team can pick it up, I am not sure of timelines yet, but we can do it within a couple of sprints. No, nothing specific towards it at the moment. |
1. We now keep all existing Mastodon connections for a post, as long as that post was published to that connection. If you've opted not to share that post to Mastodon, we do not keep that connection. 2. We keep both your own connections as well as any other global connections on the site. 3. We then sort through those connections: * We prioritize your own connections, and pick the first of them, * If you, the author, haven't published that specific post to a Mastodon connection, we look for global Mastodon connections. If there are some, we pick the first. See discussion here: #38198 (comment)
Thanks for the feedback! I just pushed 44cef09 to add some extra logic:
Would that logic align with what you had in mind? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, @jeherve! We can merge it.
I tested it on both shared and non-shared connections.
* Publicize: add Fediverse meta tag on posts when available See https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/ If we have an existing Mastodon connection on the site, let's add it as meta tag on each post. * Improve logic to support global connections. 1. We now keep all existing Mastodon connections for a post, as long as that post was published to that connection. If you've opted not to share that post to Mastodon, we do not keep that connection. 2. We keep both your own connections as well as any other global connections on the site. 3. We then sort through those connections: * We prioritize your own connections, and pick the first of them, * If you, the author, haven't published that specific post to a Mastodon connection, we look for global Mastodon connections. If there are some, we pick the first. See discussion here: Automattic/jetpack#38198 (comment) Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/9935380055 Upstream-Ref: Automattic/jetpack@fe17eb1
* Publicize: add Fediverse meta tag on posts when available See https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/ If we have an existing Mastodon connection on the site, let's add it as meta tag on each post. * Improve logic to support global connections. 1. We now keep all existing Mastodon connections for a post, as long as that post was published to that connection. If you've opted not to share that post to Mastodon, we do not keep that connection. 2. We keep both your own connections as well as any other global connections on the site. 3. We then sort through those connections: * We prioritize your own connections, and pick the first of them, * If you, the author, haven't published that specific post to a Mastodon connection, we look for global Mastodon connections. If there are some, we pick the first. See discussion here: Automattic/jetpack#38198 (comment) Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/9935380055 Upstream-Ref: Automattic/jetpack@fe17eb1
* Publicize: add Fediverse meta tag on posts when available See https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/ If we have an existing Mastodon connection on the site, let's add it as meta tag on each post. * Improve logic to support global connections. 1. We now keep all existing Mastodon connections for a post, as long as that post was published to that connection. If you've opted not to share that post to Mastodon, we do not keep that connection. 2. We keep both your own connections as well as any other global connections on the site. 3. We then sort through those connections: * We prioritize your own connections, and pick the first of them, * If you, the author, haven't published that specific post to a Mastodon connection, we look for global Mastodon connections. If there are some, we pick the first. See discussion here: Automattic/jetpack#38198 (comment) Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/9935380055 Upstream-Ref: Automattic/jetpack@fe17eb1
* Publicize: add Fediverse meta tag on posts when available See https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/ If we have an existing Mastodon connection on the site, let's add it as meta tag on each post. * Improve logic to support global connections. 1. We now keep all existing Mastodon connections for a post, as long as that post was published to that connection. If you've opted not to share that post to Mastodon, we do not keep that connection. 2. We keep both your own connections as well as any other global connections on the site. 3. We then sort through those connections: * We prioritize your own connections, and pick the first of them, * If you, the author, haven't published that specific post to a Mastodon connection, we look for global Mastodon connections. If there are some, we pick the first. See discussion here: Automattic/jetpack#38198 (comment) Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/9935380055 Upstream-Ref: Automattic/jetpack@fe17eb1
This is a follow-up to #38198, which was partially reverted in #38612. It's an alternative to #38565, to ensure better compatibility with WordPress.com Simple. 1. It takes into account the ActivityPub plugin, and ensure we're not adding a tag when the ActivityPub plugin already adds one. 2. It takes into account that on WordPress.com Simple, `get_services()` may return a `Keyring_Access_Token` object instead of an array. 3. It adds the 2 necessary methods directly to the `functions.opengraph.php` file, since we know it is loaded on the frontend on WordPress.com Simple (see conversation here to find out more: #38565 (comment) )
…38809) * Publicize: add Fediverse creator meta tag from Mastodon connection This is a follow-up to #38198, which was partially reverted in #38612. It's an alternative to #38565, to ensure better compatibility with WordPress.com Simple. 1. It takes into account the ActivityPub plugin, and ensure we're not adding a tag when the ActivityPub plugin already adds one. 2. It takes into account that on WordPress.com Simple, `get_services()` may return a `Keyring_Access_Token` object instead of an array. 3. It adds the 2 necessary methods directly to the `functions.opengraph.php` file, since we know it is loaded on the frontend on WordPress.com Simple (see conversation here to find out more: #38565 (comment) ) * Add missing since parameter
Proposed changes:
See https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/
If we have an existing Mastodon connection on the site, let's add it as meta tag on each post.
Note
This first iteration picks up the first available Mastodon connection. I think we should aim to make sure we pick the one that's assigned to the post author. @automattic/jetpack-reach Do you have any ideas on how I could do that?
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
<meta name="fediverse:creator" content="@[email protected]" />