Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

*.json.twig page not loading/showing up as page template

Started by P. Fighter 9 years ago · 1 replies · 788 views
9 years ago

So, I tried creating a JSON page but I cannot assign a page to the template as the template simply doesn't show up in the admin panel or is recognized when loaded otherwise...

9 years ago

JSON is not a template as such, rather a rendering method for API's. Any page with a corresponding .json-template, like blog.html.twig and blog.json.twig, can be access by appending .json to the end of the URL, to return it formatted as JSON.

Thus you do not create the page as JSON, but rather offer it in JSON as well.

Suggested topics

Topic Participants Replies Views Activity
General · by Andy Miller, 6 days ago
0 108 6 days ago
General · by lynbor, 1 month ago
3 437 2 weeks ago
General · by lynbor, 3 weeks ago
7 557 2 weeks ago
General · by Harry, 2 weeks ago
0 159 2 weeks ago
General · by Old Man Umby, 1 month ago
2 308 3 weeks ago