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.

General

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

Started by P. Fighter 8 years ago · 1 replies · 559 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 Jerry Hunt, 4 days ago
2 95 15 hours ago
General · by pamtbaau, 20 hours ago
1 61 19 hours ago
General · by Andy Miller, 1 day ago
0 47 1 day ago
General · by Marcel, 12 months ago
6 356 5 days ago
General · by Duc , 6 days ago
3 44 6 days ago