feat(meta-tags): add activitypub alternate links to podcast, episode, comment and post pages

This commit is contained in:
Yassine Doghri 2022-01-10 16:05:16 +00:00
parent 3ce07e455d
commit bd61752be2
1 changed files with 29 additions and 4 deletions

View File

@ -44,7 +44,12 @@ if (! function_exists('get_podcast_metatags')) {
->og('image:width', (string) config('Images')->podcastCoverSizes['large']['width'])
->og('image:height', (string) config('Images')->podcastCoverSizes['large']['height'])
->og('locale', $podcast->language_code)
->og('site_name', service('settings')->get('App.siteName'));
->og('site_name', service('settings')->get('App.siteName'))
->push('link', [
'rel' => 'alternate',
'type' => 'application/activity+json',
'href' => url_to('podcast-activity', $podcast->handle),
]);
if ($podcast->payment_pointer) {
$metatags->meta('monetization', $podcast->payment_pointer);
@ -94,7 +99,12 @@ if (! function_exists('get_episode_metatags')) {
->twitter('audio:artist_name', $episode->podcast->owner_name)
->twitter('player', $episode->getEmbedUrl('light'))
->twitter('player:width', (string) config('Embed')->width)
->twitter('player:height', (string) config('Embed')->height);
->twitter('player:height', (string) config('Embed')->height)
->push('link', [
'rel' => 'alternate',
'type' => 'application/activity+json',
'href' => url_to('episode', $episode->podcast->handle, $episode->slug),
]);
if ($episode->podcast->payment_pointer) {
$metatags->meta('monetization', $episode->podcast->payment_pointer);
@ -149,7 +159,12 @@ if (! function_exists('get_post_metatags')) {
->description($post->message)
->image($post->actor->avatar_image_url)
->canonical((string) current_url())
->og('site_name', service('settings')->get('App.siteName'));
->og('site_name', service('settings')->get('App.siteName'))
->push('link', [
'rel' => 'alternate',
'type' => 'application/activity+json',
'href' => url_to('post', $post->actor->username, $post->id),
]);
return $metatags->__toString() . PHP_EOL . $schema->__toString();
}
@ -183,7 +198,17 @@ if (! function_exists('get_episode_comment_metatags')) {
->description($episodeComment->message)
->image($episodeComment->actor->avatar_image_url)
->canonical((string) current_url())
->og('site_name', service('settings')->get('App.siteName'));
->og('site_name', service('settings')->get('App.siteName'))
->push('link', [
'rel' => 'alternate',
'type' => 'application/activity+json',
'href' => url_to(
'episode-comment',
$episodeComment->actor->username,
$episodeComment->episode->slug,
$episodeComment->id
),
]);
return $metatags->__toString() . PHP_EOL . $schema->__toString();
}