feat: append permalink to syndicated AP content + bump to 1.0.5
Notes and articles syndicated to ActivityPub now include a clickable link back to the canonical post URL at the end of the content body. This ensures fediverse clients display a visible permalink, since the Note url property alone is not shown inline by most implementations.
This commit is contained in:
@@ -82,6 +82,11 @@ export function jf2ToActivityStreams(properties, actorUrl, publicationUrl) {
|
|||||||
object.content = properties.content?.html || properties.content || "";
|
object.content = properties.content?.html || properties.content || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Append permalink to content so fediverse clients show a clickable link
|
||||||
|
if (postUrl && object.content) {
|
||||||
|
object.content += `<p>\u{1F517} <a href="${postUrl}">${postUrl}</a></p>`;
|
||||||
|
}
|
||||||
|
|
||||||
if (isArticle) {
|
if (isArticle) {
|
||||||
object.name = properties.name;
|
object.name = properties.name;
|
||||||
if (properties.summary) {
|
if (properties.summary) {
|
||||||
@@ -180,6 +185,12 @@ export function jf2ToAS2Activity(properties, actorUrl, publicationUrl) {
|
|||||||
noteOptions.content = properties.content?.html || properties.content || "";
|
noteOptions.content = properties.content?.html || properties.content || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Append permalink to content so fediverse clients show a clickable link
|
||||||
|
// back to the canonical post on the author's site
|
||||||
|
if (postUrl && noteOptions.content) {
|
||||||
|
noteOptions.content += `<p>\u{1F517} <a href="${postUrl}">${postUrl}</a></p>`;
|
||||||
|
}
|
||||||
|
|
||||||
if (isArticle) {
|
if (isArticle) {
|
||||||
noteOptions.name = properties.name;
|
noteOptions.name = properties.name;
|
||||||
if (properties.summary) {
|
if (properties.summary) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@rmdes/indiekit-endpoint-activitypub",
|
"name": "@rmdes/indiekit-endpoint-activitypub",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
|
"description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"indiekit",
|
"indiekit",
|
||||||
|
|||||||
Reference in New Issue
Block a user