From df5ead7bd4adac405811b91fed1e5f0b3775206b Mon Sep 17 00:00:00 2001 From: winter Date: Sun, 26 Jan 2025 17:23:11 +0000 Subject: add link preview metadata --- templates/actor_profile_page.php | 7 ++++++- templates/skeleton.php | 19 +++++++++++++++++++ templates/thread_page.php | 7 ++++++- 3 files changed, 31 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/templates/actor_profile_page.php b/templates/actor_profile_page.php index 3b6eb84..dbeb86a 100644 --- a/templates/actor_profile_page.php +++ b/templates/actor_profile_page.php @@ -5,7 +5,12 @@ use Digitigrade\Model\UserAccount; call_template('skeleton', [ 'pageTitle' => "$actor->displayName - @" . $actor->getFullHandle(), - 'renderTitleHeading' => false + 'renderTitleHeading' => false, + 'ogTitle' => $actor->displayName, + 'ogDesc' => $actor->bio, + 'ogImage' => $actor->avatar ?? path_to_uri('/static/default-avatar.png'), + 'ogType' => 'profile', + 'ogHandle' => '@' . $actor->getFullHandle(true) ], function () { global $actor; $user = UserAccount::findByCurrentSession(); diff --git a/templates/skeleton.php b/templates/skeleton.php index a9c3424..7f40611 100644 --- a/templates/skeleton.php +++ b/templates/skeleton.php @@ -11,6 +11,25 @@ $settings = GlobalSettings::getInstance(); <?= $pageTitle ?> — <?= $settings->get('instance.name') ?> + + + + + + + + + + + + + + + + + + + diff --git a/templates/thread_page.php b/templates/thread_page.php index 119f879..b46c968 100644 --- a/templates/thread_page.php +++ b/templates/thread_page.php @@ -4,7 +4,12 @@ use Digitigrade\Model\UserAccount; call_template('skeleton', [ 'pageTitle' => '"' . $note->plainContent . '" - @' . $note->author->getFullHandle(), - 'renderTitleHeading' => false + 'renderTitleHeading' => false, + 'ogTitle' => $note->author->displayName, + 'ogDesc' => $note->plainContent, + 'ogImage' => $note->author->avatar ?? path_to_uri('/static/default-avatar.png'), + 'ogType' => 'article', + 'ogHandle' => '@' . $note->author->getFullHandle(true) ], function () { global $note; $notes = Note::findAllInThread($note->threadApex ?? $note); -- cgit v1.3