How to quickly access viewpage.action?pageId=XYZ URL

Hi,

I don't like the tiny links, in my opinion they they look ugly, so I don't want to send and use them. However, I do need stable links that don't break when renaming a page. So I figured out I can access the Page Information page, and then change the URL from 'viewinfo' to 'viewpage' and use that link instead of the tiny URL. However, this is quite tedious, so I'd like to have a shortcut to get this URL. Could you please simply display this link in the 'Link to this Page' dialog box (K on keyboard), too?

Best regards
Martin

1 answer

1 accepted

This widget could not be displayed.
Stephen Deutsch Community Champion Mar 18, 2016

Hi Martin,

if you include this code in your custom HTML, it should do the trick:

<script>
AJS.bind("show.dialog", function(e, data) {
  if (data.dialog.id === "link-page-popup") {
    setTimeout(function() {
      if (!document.getElementById('link-popup-field-pageid-link')) {
	    AJS.$("#link-page-popup-form > fieldset").append('<div class="field-group"><label for="link-popup-field-pageid-link">Page ID Link:</label><input id="link-popup-field-pageid-link" readonly="readonly" value="' + AJS.params.baseUrl +'/pages/viewpage.action?pageId=' + AJS.params.pageId + '" class="text" type="text" onclick="this.select();"></div>');
	    data.dialog.updateHeight();
	  }
    }, 100);
  }
});
</script>

Hi Stephan,

thank you very much for posting the script. However, I don't know how and where to insert custom HTML. Can you help out? Or do you happen to know a HOWTO tutorial?

Best regards
Martin

Stephen Deutsch Community Champion Mar 18, 2016

Here's a page I found:

https://confluence.atlassian.com/confkb/how-to-use-javascript-in-confluence-313458839.html

But there's nothing so specific.

What you need to do is click on the gear icon at the top of the Confluence page (you must be a system administrator to see this) and click on the "General configuration".  You may be prompted to insert your password.  

On the next screen, look on the left sidebar for an option called "Custom HTML"

After clicking there, you'll have to click on the edit button.

Copy and paste the script above and paste it into the field under "At the end of the HEAD".  Be careful not to overwrite anything already there.

Save, and then it should be active, and you can go back to any page and test it.

Hi Stephen,

In the meantime, our Confluence Administrator added your code, and it works like a charm! Thank you so much for your help on this matter!

Best regards
Martin 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published 13 hours ago in Marketplace Apps

The 7 hacks of highly successful automation

...there's anything I've learnt from working, it's that people are lazy! No offense to anyone reading this, but it's true and we can all admit it. The easier you make something for someone, the more...

67 views 0 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you