Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Page paths and child collections

Started by Aaron Dalton 8 years ago · 1 replies · 600 views
8 years ago

My table importer plugin pulls data from the page's folder (where the .md file lives). It does this by looking at $this->grav['page']->path(). The problem is that when the page's content is generated by the blog main page (as a preview), $this->grav['page']->path() points to the blog's main page and not the individual post. The summary is pulled in as you would expect:

PHP
    {% for child in collection %}
      {% include 'partials/blog_item.html.twig' with {'page':child, 'truncate':true} %}
    {% endfor %}

How can I rectify this? I've been pouring over the API documentation, but nothing's jumping out as the answer.

8 years ago

You could put an if condition around your include, that pulls the data like it does now for each blog item, when not on the mainpage. If on the main page however try going pulling it from another layer? Might not work but I think that's the way to go

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 43 1 week ago
Plugins · by Xavier, 4 weeks ago
2 53 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1179 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 47 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 72 2 months ago