I am trying to generate the og:description tag, required by Facebook, dynamically out of the content of the shown page. My idea is to use the content-text of the page if there is no meta description given. I tried this script:
page.headerData.838 = CONTENT
page.headerData.838 {
table=tt_content
select {
where = (CType = "text")
}
renderObj=TEXT
renderObj{
field=bodytext
stdWrap.stripHtml=1
noTrimWrap =|<meta property="og:description" content="|" />|
}
}
The problem is that this tag not even appears on the page. So what’s the catch?
Try this…
Default Description:
Description if Default Description is empty:
And og:description: