Forums

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

How I set a different footer message for anonymous with javascript and HTML macro

Dennis Veenstra
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 30, 2018

For our confluence enviroment we needed to let anonymous users know that they needed to log in to comment, but I didnt want that message once they were logged in. Somehow the HTML macro didnt work in markupstyle in the footer itself.

I solved this as followed: 

On a certain page with low traffic made a hidden excerpt. Here I used the HTML Macro with this code: 

<script>

    
    if (document.getElementById("login-link").id === "login-link")  {
    
    document.write("You are not logged in. Please do to leave a comment.");
    
    } 

</script>

Then used the wiki markup to include that excerpt in the footer. 

The idea is that if someone is logged in, there is no login-link :)

1 answer

0 votes
Dave Bosman [Realdolmen]
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.
August 30, 2018

Hi @Dennis Veenstra

As always there are multiple options to solve this.

Here is 1 ;-) 

You can use this plugin to show or hide something in certain conditions. (yours will work)

In administration look for  "sidebar, header and footer" and add following text

{show-if:special=@authenticated}You are not logged in. Please do to leave a comment{show-if}

 

Regards

Dave

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events