Improve Open Graph meta tags with default description
All checks were successful
Deploy / Deploy to Production (push) Successful in 7s
All checks were successful
Deploy / Deploy to Production (push) Successful in 7s
Add default descriptions for social sharing cards: - FR: "Boutique de Index, ONG d'investigation indépendante" - EN: "Index shop, independent investigative NGO" Changes: - Add language-specific default descriptions - Fix description excerpt handling - Add OG image generation helper (create-og-image.html) - Use favicon as temporary OG image (TODO: create proper 1200x630 image) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9eb8d08bcc
commit
f3f302513e
2 changed files with 92 additions and 5 deletions
|
|
@ -3,16 +3,30 @@
|
|||
* SEO meta tags
|
||||
*/
|
||||
|
||||
// Language
|
||||
$lang = $kirby->language()->code();
|
||||
|
||||
// Basic meta
|
||||
$title = $page->customTitle()->or($page->title())->value();
|
||||
$siteName = 'Index.ngo';
|
||||
$fullTitle = $title . ' | ' . $siteName;
|
||||
$description = $page->metaDescription()->or($page->description())->excerpt(160);
|
||||
$url = $page->url();
|
||||
$image = $page->image() ? $page->image()->url() : url('assets/og-image.jpg');
|
||||
|
||||
// Language
|
||||
$lang = $kirby->language()->code();
|
||||
// Default descriptions by language
|
||||
$defaultDescriptionFr = 'Boutique de Index, ONG d\'investigation indépendante';
|
||||
$defaultDescriptionEn = 'Index shop, independent investigative NGO';
|
||||
$defaultDescription = $lang == 'en' ? $defaultDescriptionEn : $defaultDescriptionFr;
|
||||
|
||||
$description = $page->metaDescription()->or($page->description())->value();
|
||||
if ($description) {
|
||||
$description = excerpt($description, 160);
|
||||
} else {
|
||||
$description = $defaultDescription;
|
||||
}
|
||||
|
||||
$url = $page->url();
|
||||
// Use product image if available, otherwise use default OG image
|
||||
// TODO: Create assets/og-logo.png (1200x630px) with Index logo + description
|
||||
$image = $page->image() ? $page->image()->url() : url('assets/favicon.png');
|
||||
?>
|
||||
|
||||
<!-- Basic Meta Tags -->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue