4

A regular HTML file has the below structure:

<html>
<head>
<title>You page title</title
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />
</head>
<body>
.....
</body>
</html>

Generally most of the information in <head> block would be generated from a Page Template, however information for most Open Graph tags would need to be read from the component (example Product Details page) to make it more relevant and to optimize SEO.

What is the best approach to get such metadata at the page template level? We are using SDL Tridion 2013 SP1 to publish JSP pages and DCPs, if that makes any difference on the approach?

5

If you are using normal Modular templating, the usual approach is to write a .NET TBB which you can put in your page template(s) and which uses some logic to read the 'Main' component on the page, extract the metadata from it and push it into the package to be written out in your Page Template Layout.

  • 2
    So far this is the best approach. The major advantage is that it will make your life much easier in case of Translation. and the major disadvantage is that it may be difficult to find "Main" component in scenarios where DCPs are in place. Just take care that you are not having all your schema with these meta fields. – Pankaj Gaur Jun 25 '14 at 14:08
  • Will points out the "main" component can also be determined by template in this answer to a (my) similar question. – Alvin Reyes Jun 27 '14 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.