F
Filament15mo ago
Vp

How to push metadata to head section from page

I create a filament page "Detail", I am accessing using hostUrl/page/{slug} and everytime I acces another page I want dynamic meta data, how can I push this meta data to <head> section
Solution:
For now I ended up like this, but if there any better way then I would be very appreciate In render-hook page: <meta name="description", content="@yield('meta_description', 'Default meta desc.')"> In filament page @section('meta_description'){{ $data->meta_desc }}@endsection...
Jump to solution
5 Replies
Patrick Boivin
Patrick Boivin15mo ago
panels::head.start
Vp
VpOP15mo ago
Hi Patrick, using render hook could be working, I also think about this. But I am not sure how can I pass dynamic content everytime my url change.. For brief, when I go to /first-page I want to pass this firs-page meta, when visit /second-page I want to push second-page meta and so on, so I am stuck (out of idea) when/how can I pass dynamic content to render-hook view
Solution
Vp
Vp15mo ago
For now I ended up like this, but if there any better way then I would be very appreciate In render-hook page: <meta name="description", content="@yield('meta_description', 'Default meta desc.')"> In filament page @section('meta_description'){{ $data->meta_desc }}@endsection
Patrick Boivin
Patrick Boivin15mo ago
Sounds like a good solution. I was thinking you could register the render hook from your page component mount() method.
Want results from more Discord servers?
Add your server