URLMapContent Failsafe

Description

Include this code at the top of your template or in your init container so that in cases where a detail page is being hit outside of a URL Map Pattern, you can use the exact same code in your body without needing to check for content and pull in a widget, etc. That way your pages are just always set up to handle a single content map variable. This is also extremely handy if you need to use content fields before your page body, for instance customizing your HTML <title> or setting up Open Graph values.

Code

## DID THE WIKI FILTER GET US SOME CONTENT? IF NOT, TRY TO GET SOME.
#if(!$URLMapContent)
	## IS THERE AN ID AVAILABLE?
	#if($UtilMethods.isSet($request.getParameter('id')))
		#set($URLMapContent = $dotcontent.find("$request.getParameter('id')"))
	## MAYBE THEY USED A DIFFERENT URI PARAMETER...
	#elseif($UtilMethods.isSet($request.getParameter('post')))
		#set($URLMapContent = $dotcontent.find("$request.getParameter('post')"))
	#end
#end