I have a blade template master.blade
that has the following code:
<title>@yield('meta-title')</title>
And then in any views that extend this template, the data can be passed in like this:
@section('meta-title')My Meta Title @stop
However, this ALWAYS adds a space at the end. If I remove the space in the code so it looks like the following, then it will not recognise the @stop
and the page breaks:
@section('meta-title')My Meta Title@stop
Is there a way to achieve this functionality (dynamically inject content into the header without any spacing before or after) either using @yield or some other way?
Blade Template Docs
Pass a second parameter to @section
, like so: @section('meta-title', 'My Meta Title')
, no need for @stop
It is indeed in the docs: http://laravel.com/docs/5.1/blade#template-inheritance
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With