Is there any way to display the current version as text on a page? I imagine a little text in the footer that shows:
-
(While in Plasmic Studio) the current/latest version - the same that I would see when I click publish in top right and it detects the changes
-
(While viewing the published version on the web) the published version - whichever version the current page was published as.
This would be helpful while editing when I have a preview window of Plasmic Studio open in a window and a separate window with the published version.
Optionally, it could also show the published date, similar to how it’s displayed when I click on Published Versions on the left in the Studio.
This could simply be made available as some kind of variable with properties - like $version.number, $version.publish_date and I could insert it as dynamic value wherever I want it to appear.
Not at the moment! You can laboriously get at this data by looking at the props data embedded in the page if you’re using next
JSON.parse(document.getElementById("__NEXT_DATA__").text).props.pageProps.plasmicData.bundle.projects
Right now I am using the Plasmic hosting and I believe it is using Next. I see the props in the published version, but what about accessing them in the Studio or at least in Preview?
not possible at the moment…
Thanks to your suggestion, I’ve been able to display the version number easily, using this code:
Pusblished Version #:
JSON.parse(window.document.getElementById("__NEXT_DATA__").text).props.pageProps.plasmicData.bundle.projects.find(({name}) => name == "RecipeDB").version
And after some poking, I also can display the timestamp:
new Date(JSON.parse(window.document.getElementById("__NEXT_DATA__").text).props.pageProps.timestamp).toLocaleString()