This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Create Layout Using Laravel Blade Templating Engine

Updated on March 15, 2022

2 Min Read

Layouts are often the starting point of many web development projects. Laravel Blade template engine enables the developer to produce HTML based sleek designs and themes.

All views in Laravel are usually built in the blade template. Blade engine is fast in rendering views because it caches the view until they are modified. All the files in resources/views have the extension .blade.php.

Laravel blade template is pretty impressive in performance.  This tutorial will serve as an introduction to this templating engine.

Note: For the purpose of this tutorial, you will need a fresh installation of Laravel project.

Create Pages Routes

First, I will create the routes to gain access to my page. Open routes/web.php and add the following lines in it.

Route::get('/', function()


   return View::make('pages.home');


Route::get('/about', function()


   return View::make('');


Stop Wasting Time on Servers

Cloudways handle server management for you so you can focus on creating great apps and keeping your clients happy.

We are only working on views only, and thus don’t need to access the controllers.  To learn more about controllers, take a look at: Working With Controllers And Middleware

Create Views Structure

Now that the routes are ready, let’s create the Views structure by creating the following folders and files.

- resources

-- views

--- layouts

------- default.blade.php

--- pages

------- home.blade.php

------- contact.blade.php

--- includes

------- head.blade.php

------- header.blade.php

------- footer.blade.php

Create Includes

Create the following includes, with the following code:


<meta charset="utf-8">

<meta name="description" content="">

<meta name="Saquib" content="Blade">

<title>Checkout our layout</title>

<!-- load bootstrap from a cdn -->

<link rel="stylesheet" href="//">


<div class="navbar">

   <div class="navbar-inner">

       <a id="logo" href="/">Single Malt</a>

       <ul class="nav">

           <li><a href="/">Home</a></li>

           <li><a href="/contact">Contact</a></li>





<div id="copyright text-right">© Copyright 2017 Saquib Rizwan </div>

Create the Layout

I will use @include to bring in tiny parts of the code that I have created in includes folders, and @yield to bring in content from the individual pages I will be using.

<!doctype html>






<div class="container">

   <header class="row">



   <div id="main" class="row">



   <footer class="row">






Blade allows the use of the layout that I just created by using @extends. By creating @section, I will create a section that will be used in the layout. Here I will use @section(‘content’) and in the layout, everything that I will type here will be injected in @yield in the layout.

Go to resources/views/pages and put the following code in these files.




   i am the home page





   i am the contact page



This is the simple foundation and the basic steps for getting starting with Blade templating engine. Now that you know the file structures and the way Laravel Blade template engine renders the view, I will demonstrate how to integrate Bootstrap template with Laravel in my next article. So stay tuned.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Customer Review at

“Cloudways hosting has one of the best customer service and hosting speed”

Sanjit C [Website Developer]

Saquib Rizwan

Saquib is a PHP Community Expert at Cloudways - A Managed PHP Hosting Cloud Platform. He is well versed in PHP and regularly contributes to open source projects. For fun, he enjoys gaming, movies and hanging out with friends. You can email him at [email protected]


Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!


Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Unleash The Cloud.
Not Budgets.

For 4 Months +
Up To 30 Free Migrations

Cyber Week

Time Left In Offer
  • 0


  • 0


  • 0


  • 0


40% OFF

On All Plans