Page title from user macro

Ian December 6, 2017

I used $content.title to get the page title which has worked in a user macro but now I want to get only the first letter on a page title since my pages have more than one words e.g

I have a page titled AF | Afghanistan now I want to only get AF?

 

1 answer

0 votes
Stephen Deutsch
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.
December 6, 2017

Hi Ian,

Here is an example of how you might get the first word (up until the first space character):

## @noparams
#foreach ( $element in $content.title.split(" ") )
#set ( $firstWord = $element )
#break
#end
$firstWord
Ian December 6, 2017

@Stephen Deutsch Hurraaayyyy!!

Thanks alot.It has worked.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events