Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can you create a personalized greeting on a Confluence page?

Hello,

I'm editing a home page for this space and thought it might be nice to have a greeting for anyone who's visiting.

Is there a way to create a personalized greeting message at the beginning of the page? For example: Hello <person who's visiting> or something to that effect? 

I looked around on Google a bit but haven't found a specific use case. 

Does anyone have any suggestions?

Thanks so much.

1 answer

1 accepted

0 votes
Answer accepted

Hi @Cathy Li 

Welcome to the Atlassian Community.

Although Confluence doesn't have something out-of-the-box for that purpose, it is flexible enough for us to create it.
I know two possible ways we could achieve what you need. For both, you will need help from your Confluence administrator -- if it's not you smile .

Confluence HTML macro

Confluence has a macro on which we can inject HTML, which includes JavaScript code and CSS. See the HTML Macro product documentation for more details about it.

In this case, you will need a Confluence administrator to enable this Macro, since it is disabled with a default installation.
There might be some security constraints on enabling it on your company. If so, check the next solution.

If the macro is already enabled, you can use a JavaScript code to get the full name of the authenticated user -- the user reading your page.
The code below is a simple one to get you started in case you choose this option.

Hi
<script type='text/javascript'>
document.write(AJS.params.currentUserFullname);
</script>

In the editor, this code with the HTML macro will look like the below

user-macro-001.png

 

Then, a user reading the page would see something like this

user-macro-002.png

 

User Macro

You may also choose to take advantage of the user macros feature in Confluence.
With this feature you can create your own macros and use it on any page, similar to the default macros shipped with Confluence or the Marketplace Apps.

This might be a preferred approach since any user in your instance may take advantage of the macro once it is configured.
You will need help from a Confluence administrator to publish this macro.

To get you started, the user macro code will be like this:

## Macro title: current-user
## Macro has a body: N
## Body processing: N
## Output: remote user name
##
## Developed by: <Name>
## Date created: <dd/mm/yyyy>
## Installed by: <Name>
## @noparams

$action.authenticatedUser.fullName

 

Below is a screenshot of the full configuration for the user macro -- you may change it depending on your environment.

user-macro-003.png

 

After the macro is published by the Confluence administrator, you can use it in your page by typing its name in the editor.

user-macro-004.png

 

While in the editor your page would look like below, users reading it would see their name.

user-macro-005.png

 

 

I hope one of these approaches helps you with what you need.

Kind regards,
Thiago Masutti

Hi @thiagomasutti 

Thanks so much for the detailed answer :) I appreciate the thoroughness. 

I'm not an admin but I guess the HTML macro has been enabled. 

I tried the first option and worked like a charm. Thanks again.

Hi @thiagomasutti 

Sorry to back track one step – I know that Confluence doesn't distinguish given name from surname, but is there a work-around to display only the current user's given names? 

Thank you so much for your help.

Hi @Cathy Li 

Confluence may not have that information, but we may try something with Java Script.

We can take the full name as a string, split it based on spaces and show only the first part of the substring.

In my case it would be Thiago; Cathy in yours.
It's not bullet proof, but may work most of the times.

The new code should be something like this:

Hi
<script type='text/javascript'>
document.write(AJS.params.currentUserFullname.split(" ")[0]);
</script>

 

Let me know if that helps.

Kind regards,
Thiago Masutti

Hi @Thiago Masutti  

You are a genius! Thanks so much :)

On our Confluence, the names are organized as Last Name, First Name, so I changed the 0 to 1 from your code and it worked!

Thank you so so much and thank you for helping again after the initial issue is resolved :) 

Have a great weekend.

Hi @Cathy Li 

That's great!!!

I'm glad to know it helped.

Have a great weekend too.

Regards

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

🥓🙅🏻‍♀️ Meet-less May Badge!

Hello Confluence Community!  What if i told you that you could have a healthier life and be 100% meet-less? This month, we're promoting a healthy, balanced work diet with Confluence. (Read m...

357 views 3 18
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you