Reputation: 10806
I want to know what data is avalible to me in a portal template, but it doesn't output anything.
I've tried printing the sitemap like this
{% sitemap | json %}
But that doesn't yield anything, so I tried
{% for x in sitemap %}
{% for y in x %}
{{ y }}
{% endfor %}
{% endfor %}
But still nothing. Any tips to get any data? Preferably the root data object, if there is such a thing.
Upvotes: 0
Views: 43
Reputation: 537
The top level node in the sitemap object is sitemap.root
. There are additional properties on the sitemap node objects that need to be accessed to output information.
Here's an example of rendering out the root sitemap node and its child pages, by accessing the children
property of the root node, and the url
and title
of each child sitemap node.
<ul>
<li><a href="{{sitemap.root.url}}">{{ sitemap.root.title }}</a>
<ul>
{% for child in sitemap.root.children %}
<li><a href="{{child.url}}">{{ child.title }}</a></li>
{% endfor %}
</ul>
</li>
</ul>
See the documentation for the sitemap object for more information on its structure.
Upvotes: 1