Next Js dynamically change template layout for page data created in Strapi

  javascript, next.js, reactjs, strapi

The goal:
We have a home page called: https://example.com
and the homepage has pages called about us, about company, contact us and services respectively which are all stored inside Strapi

https://example.com/about-us  
https://example.com/about-company  
https://example.com/contact-us  
https://example.com/services

The front-end design is done in nextjs and there are two template layouts created called template1.js and template2.js.

The goal here is that a content manager (CM) working on Strapi should be able to pick any template and render the json data from strapi using the template that was selected by the CM.

Source: Ask Javascript Questions

LEAVE A COMMENT