1

My problem is: If I have a page written this way: (saved home.en.md)

title: 'Home'
published: true
metadata:
    keywords: 'home'
taxonomy:
category:        - main
tag: - 'home'
menu: 'Home'
   slug: home
process:
    twig: true
routable: true
cache_enable: true
visible: true
content:
    items: @root
    order:
        by: date
       dir: desc 
    limit: 10
    pagination: true
---
This are all our pages:

how and where do I have to add the twig text?

{% for p in page.collection %}
 <h3> {{ p.title }} </h3>
 {{ p.summary }}
 {% endfor %}

1 Answer 1

1

I resolved this by adding

template: name-of-template

and in my themes folder I added a name-of-template.html.twig :

{% extends 'partials/base.html.twig' %}
{% block content %}
<ul>
{% for p in page.collection %}

    <h3> {{ p.title }} </h3>
    {{ p.summary }} <br>
   <a href="http://example.com{{p.url}}"> {{ p.title }} </a> <br>
   {# could return http://example.com/my-section/my-category/my-blog-post #}

{% endfor %}
</ul>
{% endblock %}

I hope this will help someone!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.