how does partials module work?

stevenweijdt - 6 months ago

I've tried to add this to the view.twig file of the pages module: {% include "partials::blabla" %}

I also tried to add it to the content field of a page. blabla is the slug of the partial I made. There's no documentation. So I have no idea how and where to use the partials I made. Templates module just works.

ryanthompson - 6 months ago

I think I might go ahead and release document this one.. test er our for me! We've used it in production a few times but will be nice to have more eyes on it:

{{ partial($slug) }}

If a partial is a relationship - then you can do like:

{{ page.partial|raw }}

stevenweijdt - 6 months ago

I've added this to the view.twig and to the content type of a page: {{ partial($slug) }} {{ partial("blabla") }} {{ partial(blabla) }}

I'm trying everything. Doesn't seem to work

stevenweijdt - 6 months ago

So $slug is a string. It's the slug name you can find here:

yourdomain.dev/admin/partials

(you need to create a partial first there. If you already have one, click on edit) When you call your partial My Partial, the slug will become my_partial.

yourdomain.dev/admin/pages/types/edit/1

if you go here you find the default type for a page. Add the partial code to the layout field on the bottom of the page like this:

{{ partial('my_partial') }}

You can also edit a page and add the {{ partial('my_partial') }} to the content field:

yourdomain.dev/admin/pages/edit/1

That's the welcome page that comes out of the box with pyro.