Pull in your SEO Friendly Meta Description & Keywords


The SEO fields in Page Properties > Advanced Properties collect meta description and meta keywords.  A simple regex string replace here to remove leading & trailing white space.


#set($RegexPatternLeadingWhiteSpaceTrailingLineBreaks = "(^\s*|[\n\t\r])")
#if ($UtilMethods.isSet($HTMLPAGE_KEYWORDS))
	<META name="keywords" lang="en-us" content="$HTMLPAGE_KEYWORDS.replaceAll($RegexPatternLeadingWhiteSpaceTrailingLineBreaks, "")">
#if ($UtilMethods.isSet($HTMLPAGE_DESCRIPTION))
	<META name="description" lang="en-us" content="$HTMLPAGE_DESCRIPTION.replaceAll($RegexPatternLeadingWhiteSpaceTrailingLineBreaks, "")">

Have you created code you'd like to share with the dotCMS community?

Share your code Become a Contributor