Scroll Versions' handling of page links and versions is optimized to provide consistency for users without losing context. Scroll Versions overwrites page links within the same space to always point to the current version. For this reason, it isn't normally possible to "hotlink" to a page in a specific version from a page that is in another version. In some cases however, this might become necessary and as a workaround, find below the code for a user macro that generates such links.

Creating the macro

To create the user macro, select the following settings:

Paste the following code into the Template section:

## Macro title: Scroll Versions Hotlink
## Macro has a body: N
## @param Link:title=Link|type=string|required=true|desc=Weblink to the dot page.
## @param Version:title=Version|type=string|desc=Choose the version to link to
## @param Linktext:title=Link text|type=string|required=true|desc=Text to display for your link

<a class="sv-hotlink" href="#" data-link="$paramLink" data-version="$paramVersion"  target="_self">$paramLinktext</a>
<script>
    function addVersionParameters() {
        var hotlinks = $('a.sv-hotlink');
        hotlinks.each(function(){
            var linkAddress = $(this).attr('data-link');
            var versionName = $(this).attr('data-version');
            var params = 'scmVersionId=' + getVersionId(versionName) + '&scroll-versions:version-name=' + versionName;
            $(this).attr('href', linkAddress+questOrAmpers(linkAddress)+params);
        });

    };

function questOrAmpers(url) {
    if (url.indexOf("?") > -1) {
        return "&";
    } else {
        return "?";
    }
}

function getVersionId(versionName) {
    var allVersions = Scroll.Versions.Context.space.allVersions;
    var i = 0;
    while (i < allVersions.length) {
        if (allVersions[i].name === versionName) {
            return allVersions[i].id
        }
        i++;
    }
}
addVersionParameters("$paramLink", "$paramVersion", "$paramLinktext");
</script>
JS

Using the macro

To use the macro, provide these parameters:

  • Link: Navigate to the exact page in the exact version you would like to link to and copy the URL from the browser bar. Both the Page title and Page ID format are supported.
  • Link text: Display text for your link.
  • Version: Enter the name of the version you would like to link to.

This macro can also be used in Scroll Viewport using the Scroll Versions integration. Just keep in mind that the link goes to a Confluence page, so only users without access to the Confluence UI for that particular Viewport will end up in the Viewport view of the page.