Table of contents

laravel blade section

In this post, you will learn about the Laravel 9 blade section with an example. Laravel blade @section is a directive that will able us to inject content layout from the extended blade. The content of the section will show the layout using the @yield directive.


Now let's create a folder layouts inside resources/views and then create a file master.blade.php.



<!DOCTYPE html>
        <title>@yield('title') - App Name</title>
        <div class="container">


Then next let's create our child blade inside resources/views usually, it is home, contact, page, etc.


As you can see we use @extends, and @section directives. For more about Laravel Blades kindly visit their documentation here:




@section('title', 'Page Title')

    <p>This is your content body.</p>


I hope it helps. If you want to know about Laravel blade templating you can visit our previous tutorial here.