Currently, I am facing a big issue about preview function. I am using react as my frontend part, but i also need to support preview mode. I can get the "latest" version of data, but it is Icontent type, many function is missing or hard to find (not like ipublishedcontent).
Any idea how to convert the IContent object to Ipublishedcontent??
IContent To IPublishedContent
Guys,
Currently, I am facing a big issue about preview function. I am using react as my frontend part, but i also need to support preview mode. I can get the "latest" version of data, but it is Icontent type, many function is missing or hard to find (not like ipublishedcontent).
Any idea how to convert the IContent object to Ipublishedcontent??
Thanks~
Hi Stephen,
Are you using Umbraco 7 or 8?
If it's Umbraco 8, then you can pass the
preview
parameter astrue
to the API call.e.g.
That will give you the latest draft (saved, no published) content.
For v7, it's not as straight-forward, but there are code solutions that may help convert
IContent
toIPublishedContent
. I'm happy to share.Cheers,
- Lee
I am using 8. Oh Thanks Kelleher, it works now~
you get with this aproatch unpublished content as IPublishedContent but..... all children collections have only published result.
is working on a reply...