How to create a new page/route on the fly and display it as "preview"?

Similar to a WordPress post/page editor:

  • I have an app that lets users edit HTML.
  • I would like to have them preview it as a separate page with temporary route (that no other can access later)
  • Once finalized, I need to save the edited HTML into a page of its own, with its own slug / route

Now, what is the right approach / packages to solve this correctly?

You can have a route with dynamic parts. For iron:router you find the documentation about it here. There are also other routers that you can find on Atmosphere.

1 Like

Thanks @Sanjo It is helpful.

Iā€™d store the content in a collection (or even embed it in the users collection as a hashtable, where a token is the key)

then, Iā€™d create a dynamic route, something along: ā€˜/my-page/:tokenā€™, and utilize Iron Router to control access to it (i.e. checking the user id etc)

you might also allow users to add titles, and then use the titles to automatically generate permalinks to their finalized page
e.g. title = ā€œcooking is funā€ -> permalink = ā€œcooking-is-funā€

1 Like

Thanks @chenroth I will explore the collections and router methodology.