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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.