I want to update the meta tags
of my 404 error page
ie 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!
<title>
@if(isset($title))
{{ $title }}
@endif
</title>
@if(!isset($meta_description))
$meta_description = '404';
@endif
<meta name="description" content="{{ $meta_description }}">
@if(!isset($meta_keyword))
$meta_description = '404';
@endif
<meta name="keywords" content="{{ $meta_keyword }}">
You can try something like this.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.