Dynamic HTML Header Description

Hi,

I’m currently using this method Extract first two paragraphs from a page to create the following HTTP META INFO in Global Administration: Presentation:

#set ($xdom = $tdoc.getXDOM())
#set ($block = $xdom.getFirstBlock('class:ParagraphBlock','DESCENDANT'))
#set ($xwikiSyntax = $services.rendering.render($block, "plain/1.0"))
<meta name="description" content="$escapetool.xml($!xwikiSyntax)" />

For normal pages, it works as expected; however, it doesn’t work with extensions such as the blog extension. When it doesn’t work, the html created is:

<meta name="description" content="$escapetool.xml($!xwikiSyntax)" />

Is there any other methods that could dynamically create an html description based on the content of the page?

Best Regards,
Leon