2016-08-16 79 views
1

我的問題是: 如果我有一個網頁,這樣寫的: (保存home.en.md)如何顯示樹枝收集GRAV

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: 

如何以及在哪裏做我必須添加樹枝文字?

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

回答

1

我解決了這個加

template: name-of-template 

,在我的主題文件夾我添加了一個名稱的-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 %} 

我希望這將幫助他人!