Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can a `page` within a `space` link to an external URL?

Doug Kenerson September 4, 2018

Can a page within a space link to an external URL? The workaround is that I add some text within the page. That text then links to the external URL. Thanks!

2 answers

0 votes
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 5, 2018

You can create a user macro to do this. @Stephen Deutsch has created a user macro for this. Here is his code. I wouldn't make the timeout 0 though ... it makes it hard to edit the page if you need to. : )

https://bitbucket.org/stephendeutsch/confluence-user-macros/src/

Macro Name:
redirect_macro

Macro Title:
Redirect Macro

Macro Body Processing:
No macro body

Template:

## Macro title: Redirect Macro
## Body processing: N
##
## Developed by: Stephen Deutsch
##
## This macro redirects the user from the current page to a new page defined in the options.
## This macro more or less duplicates the functionality of the ServiceRocket Redirection Plugin

## Copyright 2014 zanox AG
## 
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
## 
##     http://www.apache.org/licenses/LICENSE-2.0
## 
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.

## @param location:title=Location|type=string|required=true|desc=The URL to redirect to
## @param delay:title=Delay|type=string|default=0|desc=The number of seconds to delay before redirecting the browser.

#set ( $Integer = 0 )
#set ( $delay = "0" )
#set ( $delay = $paramdelay )
#set ( $delay = $Integer.parseInt($delay) * 1000 )
#if ( $req.getParameter('redirect') != "false" )
  <script>
  setTimeout(function() {
    window.location = "$paramlocation";
  }, $delay);
  </script>
#end

<ac:macro ac:name="note">
  <ac:parameter ac:name="title">Redirection notice</ac:parameter>
  <ac:rich-text-body>
    <p>This page will redirect to <a href="$paramlocation">$paramlocation</a> in about $delay seconds.</p>
  </ac:rich-text-body>
</ac:macro>
0 votes
Tobias Anstett _K15t_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2018

Hi,

you can’t do this by default, however our approach to this issue is adding a redirect macro to the page which does the job. However this is a custom macro which is not available on the marketplace :(

Bedt, Tobias

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events