Skip to content

Named slots for partials #492

Closed
statamic/cms
#4257

Description

@johncarter-

It would be great to be able to do something like Blade component named slots when using partials.

I guess it would look like this:

{{ partial:two-column }}
    {{ slot:sidebar }}
        <p>This goes in the sidebar!</p>
    {{ /slot:sidebar }}
    <p>Else we are just using a plain old slot, so stick this in the main column</p>
{{ /partial:two-column }}
{{# resources/views/partials/two-column.antlers.html #}}

<div class="flex">
    <div class="w-1/4">
        {{ slot:sidebar }}
    </div>
    <div class="w-3/4">
        {{ slot }}
    </div>
</div>

Hopefully I am not missing something obvious which achieves something similar ( like section and yield 🤔 ).

Activity

  1. jackmcdade commented on Mar 12, 2021

    @jackmcdade
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions