Using $scrollVersions object in a theme template
Hello,
We are looking at overriding the default menu items in our theme for PDF and EPUB export so that we can dynamically generate an export link based on a language of the page.
We would construct the export links as described in the REST API doc.
We are using Scroll Versions so we would like the links to include the page variant and version id.
I know that the exporters have the $scrollVersions.Version.Id and $scrollVersions.Variant.Id placeholders.
Are these properties or possibly other objects with these properties available for use in a theme?
Thank you for your help,
Pavel
-
Hi Pavel,
these placeholders are only available during exports.
However if your template includes the page info panel provided by Scroll Versions (provided by the {sv-pageinfo} macro) then you will find the version and variant ids in a javascript context.
Using your web browser's developer tools, have a look for these global javascript objects:
- Scroll.Versions.Context.modules
- Scroll.Versions.Context.user
This first one contains information about which parts of Scroll Versions are enabled in the current space (version and variant management etc.). The second object contains information about the version and variant that the user has currently selected.
Using this objects you should be able to create the export link with version and management IDs.
Let us know if that helped.
Cheers,
Jens -
Hello,
I use page info panel and i am not able find out Version ID. Java object does not work. Version ID placeholder is not available in a viewport theme. I need use $Version.Name (https://k15t.jira.com/browse/EXP-1095) in my PDFs and I need use version ID for PDF export link in public viewport theme. Is it possible now?
Thank you for your help,
Michal
-
Hi Michal,
Thanks for contacting us. I'm not sure if I completely understand your questions, so please feel free to add any further details.
The export PDF button can be implemented with Viewport. To add a link that would generate a PDF using Confluence inbuilt PDF exporter and download it to client's computer, please use the following code:<a href="/confluence/spaces/flyingpdf/pdfpageexport.action?pageId=$page.id"> <span> Export to PDF </span> </a>
You might want to change the URL to reflect your Confluence set up (for example, you don't need "/confluence" if you don't have a context path). Please use URL placeholder for reference: https://www.k15t.com/display/VPRT/Url.Due to the JIRA issue you mentioned, the placeholder does currently not work as expected, as it returns "Currently Published".
Which version of Scroll Versions are you currently using? As for the Version ID, I assume you can't retrieve it because you are viewing the Currently Published version. That version is not a real version and doesn't have any ID as it is a plain Confluence page.
Does this help? It would be great if you could further describe your use case.
If you have more Scroll Viewport related theme questions, please feel free to directly contact our Viewport developers by using our Scroll Viewport Googlegroup: https://groups.google.com/forum/?hl=en#!forum/scroll-viewport-dev
Best,
Nils -
Hi Nils,
thank you for answer. I use scroll viewport, scroll version, scroll translation and scroll pdf exporter. I want use viewport for documentation website. So every one space (viewport) has a lot of versions and translations. My issues are: I need version and translation language for my PDF document which I want export by scroll PDF exporter. But I am not able export PDF with correct version (https://k15t.jira.com/browse/EXP-1095) and I am not able export PDF via link from viewport because I am not able find out Version ID via placeholder. So I am looking for solution how to use scroll PDF exporter in viewport for public users.
Thank you for your help,
Michal
-
Hi Michal,
Thanks for the further details.
Would it work for you, to have an "Export to PDF" button on the homepage of every version of your documentation (in the content area) - see https://help.k15t.com/scroll-pdf-exporter/how-can-i-insert-a-export-button-to-a-page-82511645.html?Best,Nils
-
Hi Nils,
Thank you. Unfortunately the macro works great when I am logged in but not for public access. I did not find solution yet. I want use PDF link on a viewport template sidebar. Does an atachement list placeholder exist? I dont want use a hard link for everyone attachement.
Thank you for your help,
Michal
. -
Hi Michal,
using the REST call url (see https://help.k15t.com/scroll-pdf-exporter/creating-an-export-using-the-rest-api-75367868.html), you could create a button that opens this URL on click and creates the export with the predefined Export Scheme.
Would that help?
Best,
Nils
Please sign in to leave a comment.
Comments
7 comments