Search code examples
phphttp-status-code-404laravel-5.4meta-tagscustom-error-pages

How to add Meta tags for 404 error page in Laravel 5.4


I want to update the meta tags of my 404 error page i.e. 404.blade.php of my Laravel 5.4 website.

404.blade.php page is located at path: \resources\views\errors

All the other pages that I have build having controller from where I am easily passing meta title, meta description and meta keyword and using them in my front design common file as shown below.

<title>
@if(isset($title))
    {{ $title }}
@endif
</title>

@if(isset($meta_description))
    <meta name="description" content="{{ $meta_description }}">
@endif

@if(isset($meta_keyword))
    <meta name="keywords" content="{{ $meta_keyword }}">
@endif 

But in the case of 404 error page, I don't have any controller from where I can pass its meta tags. So left clueless how to add meta tags for 404 error page.

Please help me!


Solution

  • I have added another design layout error-design.blade.php specially for 404 Error page and added all 404 meta tags there. Now its working fine.