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 Inject Caching issue

Solved by Claud Rusnac View solution

Started by Claud Rusnac 8 years ago · 2 replies · 663 views
8 years ago

I am having an issue when using a custom template. I am injecting a page using a custom template:

[plugin:page-inject](/4.0/4.2/4.2.1/4.2.1.1?template=simple)

The template is very simple:

HTML
<div class="standard-embed">
    <h3><a href="{{ page.url }}">{{ page.title }}</a></h3>
    {{ page.content }}
</div>

Everything is working as expected, with the exception of caching. When I load the page that contains the injected pages, the simple template is rendered. My challenge comes when I try to navigate to the /4.0/4.2/4.2.1/4.2.1.1 page, it loads the cached simple template?

When caching is disabled, this behavior is not exhibited, so this leads me to believe that it's a caching issue. Ideally, when injecting a page, it shouldn't write to the cache.

8 years ago

Any Ideas on this? There should be a way to load content via a template and not write it to the cache.

8 years ago Solution

I ended up using native GRAV method to achieve the same functionality:

TWIG
{% include 'simple.html.twig' with {'page': page.find('/4.0/4.2/4.2.1/4.2.1.1')} %}

This resolved my problem. Caching works as expected.

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