I've been developing an application with Laravel 5.4 and Bootstrap and recently I noticed that the information placed under the head
tag is being generated within the body
tag after the @yield
. Strange enough other applications work good and I've checked the encoding and all the files are encoded with UTF-8
.
I've also checked previous questions but none seem to fix the issue, I believe it might be something deep within laravel, however, it's hard to find.
Here's an example of what's happening
app.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<!-- meta, link and other tags are defined here -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="/img/favicon.ico" type="image/x-icon">
</head>
<body>
@yield('main')
<!-- some script tags are defined -->
@yield('scripts')
</body>
</html>
home.blade.php
@extends('templates.app')
@include('templates.navbar')
@section('main')
<div class="container">
<!-- content goes here -->
</div>
@endsection
@section('scripts')
<script>
<!-- some script related to the page goes here -->
</script>
@endsection
When the webpage is viewed the following is generated
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Empty head tag -->
</head>
<body>
<div class="container">
<!-- content goes here -->
</div>
<!-- some script tags are defined -->
<script>
<!-- some script related to the page goes here -->
</script>
<!-- meta is defined after the two @yields -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="/img/favicon.ico" type="image/x-icon">
</body>
</html>
I've been trying to understand what's happening, I've seen situations, like I said, related to encoding but that doesn't seem to be the problem, it might be a simple mistake that's making laravel render the header information inside the head tag.
via RebeloX