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

Federated Reply block: embed original post on frontend #1027

Open
jeherve opened this issue Nov 29, 2024 · 0 comments · May be fixed by #1100
Open

Federated Reply block: embed original post on frontend #1027

jeherve opened this issue Nov 29, 2024 · 0 comments · May be fixed by #1100
Assignees
Labels
[Block] Federated reply Respond to posts, notes, videos, and other content on the fediverse. [Status] In Progress [Type] Enhancement New feature or request

Comments

@jeherve
Copy link
Member

jeherve commented Nov 29, 2024

What

The Federated reply block is very useful for a site to become a real actor on the Fediverse. Once we publish a post using that block, our reply looks good on the Fediverse. I was wondering if we could embed the original post instead of "only" rendering a link to that post:

/**
* Render the reply block.
*
* @param array $attrs The block attributes.
*
* @return string The HTML to render.
*/
public static function render_reply_block( $attrs ) {
/**
* Filter the reply block.
*
* @param string $html The HTML to render.
* @param array $attrs The block attributes.
*/
return apply_filters(
'activitypub_reply_block',
sprintf(
'<p><a title="%2$s" aria-label="%2$s" href="%1$s" class="u-in-reply-to" target="_blank">%3$s</a></p>',
esc_url( $attrs['url'] ),
esc_attr__( 'This post is a response to the referenced content.', 'activitypub' ),
// translators: %s is the URL of the post being replied to.
sprintf( __( '&#8620;%s', 'activitypub' ), \str_replace( array( 'https://', 'http://' ), '', $attrs['url'] ) )
),
$attrs
);
}

Why

This would allow readers that consume the site content from the site, and not from the Fediverse, to read the original post right away, without having to click, and thus have all the context of the conversation in one place, just like folks on the Fediverse experience.

How

I know that Fediverse embeds are a bit tricky, but maybe we could start with some support for Mastodon, based off the learnings from this trac ticket.

@jeherve jeherve added [Block] Federated reply Respond to posts, notes, videos, and other content on the fediverse. [Type] Enhancement New feature or request labels Nov 29, 2024
@obenland obenland linked a pull request Dec 18, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Federated reply Respond to posts, notes, videos, and other content on the fediverse. [Status] In Progress [Type] Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants