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

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

Started by P. Fighter 8 years ago · 1 replies · 695 views
8 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...

8 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 jean-louis67, 3 weeks ago
2 308 3 weeks ago
General · by Andy Miller, 3 weeks ago
0 310 3 weeks ago
General · by Veehem, 4 weeks ago
0 263 4 weeks ago
General · by milkboy, 4 weeks ago
0 264 4 weeks ago
General · by ian russell, 1 month ago
2 335 1 month ago