Partials

Partials

Partials are markup fragments created to reuse them across different templates. Partials have access to all the data available to the parent template, including inline variables.

You may include a partial inside a template using the @include tag. The tag accepts the relative path to the template file.

@include('partials/header')
<main>
The main content goes here
</main>
@include('partials/footer')

You may include partials from other disks by prefixing the disk name before the template path.

@include('shared::partials/header')
@include('shared::partials/footer')

Include conditionally

You may use the @includeIf method to conditionally include partials when a given statement returns true. For example:

@includeIf(post.comments.length, 'partials/comments')

On this page