How to render data from when it's included as a partial?

I’ve tried to look for information in the documentation, but couldn’t find anything on that.

I have a modular page and trying to add a footer as a partial, but currently no data from is being displayed.

I’ve added this code to the base.html.twig:
{% include 'partials/footer.html.twig' %}

This is working fine, but now, how do I render data from the file?

title: Footer
routable: false
    - icon: "facebook"
      link: ""
    - icon: "twitter"
      link: ""
    - icon: "behance"
      link: ""
    - icon: "linkedin"
      link: ""
    - icon: "pinterest"
      link: ""
copyright: "Project X 2015"
text: "Made with love for great people"
fonticon: "caret-up"
href: "#home"


    <ul class="footer__sm__list">
        {% for item in page.header.icons%}
            <a href="{{}}">
                <i class="fa fa-{{item.icon}} fa-2x footer__sm__icon"></i>
        {% endfor %}
    <p>{{ page.header.copyright }}</p>
    <p>{{ page.header.text }}</p>
    <a href="{{page.header.href}}" class="footer__up"><i class="fa fa-{{page.header.fonticon}} fa-3x" aria-hidden="true"></i></a>

Try something like this:

The code to include in base.html.twig must be:

{% include 'partials/footer.html.twig' with {'page': page.find('/footer', true)} %}

The file should be located in a folder called footer in user/pages

I tried it, it works


Here is one of my favorite ways:

{% set content = pages.find('/footer').content %}
{% if content %}
   {{ content }}
{% endif %}

This should work for Partials too…


Thanks a lot! I’ve used your method and it worked!

Used the other one and it worked fine, but will try out yours as well. Many thanks!

1 Like