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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.