inertiajs / inertia-laravel

The Laravel adapter for Inertia.js.
https://inertiajs.com
MIT License
1.99k stars 222 forks source link

How to update favicon, meta tags like descripiotn, keywords, openGraph(og) etc. #643

Closed Adiconquerors closed 4 weeks ago

Adiconquerors commented 1 month ago

How to update favicon, meta tags like descripiotn, keywords, openGraph(og) etc.

I tried to implement Head component using the link, meta tags are not updating dynamically.

Iam using Laravel 11 and Vue3.

My Sample code here:

<Head>
    <title>{{settings.site_title}}</title>
    <link rel="icon" :href="settings.site_favicon" sizes="32x32"/>
    <meta head-key="description" name="description" :content="settings.seo_meta_description">
    <meta head-key="keywords" name="keywords" :content="settings.seo_meta_keywords">

    <meta property="og:image" :content="settings.site_favicon">
    <meta property="og:image:type" content="image/png">
    <meta property="og:image:width" content="436">
    <meta property="og:image:height" content="228">
    <meta property="og:description" :content="settings.seo_meta_description">
</Head>

and I have following tages in app.vue file:

<title inertia>{{SITE_TITLE}}</title>
<meta name="description" content="my description">
<meta name="keywords" content="my keywords">
<meta property="og:image" content="{{asset('assets/logo.jpg')}}">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="436">
<meta property="og:image:height" content="228">
<meta property="og:description" content="my description">

Note: Title is updating dynamically, but meta tags are not updating dynamically.

driesvints commented 4 weeks ago

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.