Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tito 288 posts 500 karma points
    May 06, 2021 @ 14:51
    Tito
    0

    Making Umbraco CMS v8 custom headless: Preview mode?

    I need a custom Umbraco 8 Headless for a project which i am using to query from a nextjs web site. I have successfully achieved it using route hijacking to return json using: https://our.umbraco.com/documentation/reference/routing/custom-controllers

    The nextjs web can query and navigate the umbraco content, using the umbraco url system, and works great!

    Now i would like to get preview mode for the nextjs web.

    Right now i have a template that redirects to the exact url on nextjs web so when you click on the url from the Info tab on Umbraco it gets to the web site.

    My idea is when preview, redirect to the nextjs web with a flag param that makes the nextjs query content to umbraco and get non published content if the controller gets some kind of flag.

    I know i can return non published using the content service, but i want to use the Umbraco helper.

    I would like to know how Umbraco does it internally when you click preview button on the backoffice, because it uses the same code of the templates to render non published content.

    How it works? how could i trick Umbraco from a controller to do it?

Please Sign in or register to post replies

Write your reply to:

Draft