From 5a1fb32d437f369b6fdaad4bfa29b26ce8123705 Mon Sep 17 00:00:00 2001 From: SofianeLasri <alasri250@gmail.com> Date: Thu, 20 Feb 2025 14:59:37 +0100 Subject: [PATCH] feat: add Open Graph meta tags to enhance SEO and sharing capabilities - Added Open Graph locale, title, type, URL, description, and image meta tags to the public layout. - Updated the portfolio show view to pass description and image data for Open Graph tags. --- resources/views/layouts/public.blade.php | 17 +++++++++++++++++ resources/views/public/portfolio-show.blade.php | 6 +++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/resources/views/layouts/public.blade.php b/resources/views/layouts/public.blade.php index f2a8ee1..34fecbc 100644 --- a/resources/views/layouts/public.blade.php +++ b/resources/views/layouts/public.blade.php @@ -8,6 +8,23 @@ <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> @vite(['resources/scss/public.scss', 'resources/js/app.js']) + + <meta property="og:locale" content="{{ config('app.locale') }}"> + <meta property="og:locale:alternate" content="{{ config('app.fallback_locale') }}"> + @if(!empty($title)) + <meta property="og:title" content="{{ $title }}"> + @endif + <meta property="og:type" content="website"> + <meta property="og:url" content="{{ url()->current() }}"> + @if(!empty($description)) + <meta name="description" content="{{ $description }}"> + <meta property="og:description" content="{{ $description }}"> + @endif + @if(!empty($image) && is_a($image, \App\Models\UploadedPicture::class)) + <meta property="og:image" content="{{ $image->getFullsizeUrl() }}"> + <meta property="og:image:width" content="{{ $image->width }}"> + <meta property="og:image:height" content="{{ $image->height }}"> + @endif </head> <body> @yield('content') diff --git a/resources/views/public/portfolio-show.blade.php b/resources/views/public/portfolio-show.blade.php index 9a8127f..bd3173a 100644 --- a/resources/views/public/portfolio-show.blade.php +++ b/resources/views/public/portfolio-show.blade.php @@ -1,4 +1,8 @@ -@extends('layouts.public', ['title' => $creation->nameTranslationKey->getTranslation()]) +@extends('layouts.public', [ + 'title' => $creation->nameTranslationKey->getTranslation(), + 'description' => $creation->shortDescriptionTranslationKey->getTranslation(), + 'image' => $creation->coverUploadedPicture +]) @section('content') <x-public.navbar class="container mx-auto px-4"/> -- GitLab