Skip to content

Context missing from dynamicInclude in multisite #60

Open
@chrismlusk

Description

@chrismlusk

I'm having issues with dynamically including a template in a multisite setup.

Take the following example, which is being used in a for block in blocks loop:

{% dynamicInclude "_blocks/productList.twig" with {block: block} only placeholder %}
    {% include "_partials/product-list-skeleton.twig" %}
{% endDynamicInclude %}

In the primary site, everything works great. In my second site, however, my block variable is missing from the context. The ?p=actions/servd-asset-storage/dynamic-content/get-content request comes back with the following Twig runtime error:

Impossible to access an attribute ("headline") on a null variable.

And that's because within my productList.twig template, I'm calling block.headline.

While investigating the issue, I tried replacing the dynamic include with a default include, and everything worked fine on my second site.

Versions

  • Plugin 3.2.8
  • Craft 4.3.10

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