2016-08-16 62 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 %} 

我希望这将帮助他人!