Meta Tag Rules: Site Integration

Use the following APIs to obtain page meta tags that are generated based on rules:

You can then add them into your dw.web.PageMetaData container to have them available in your header generation, as shown in this example:

updatePageMetaTags: function (object)
   if ( object.class === dw.content.Content
       || object.class === dw.system.Site
       || object.class === dw.catalog.Product
       || object.class === dw.catalog.ProductSearchModel
       || object.class === dw.content.ContentSearchModel)
       var pageMetaData = request.pageMetaData;

The dw.web.PageMetaData container supports a loop approach, creating all your page meta tags in an easy way:

 <iscomment>Rule based page meta tags</iscomment>
 <isloop items="${pdict.CurrentPageMetaData.getPageMetaTags()}" var="pageMetaTag">
     <isif condition="${pageMetaTag.title}">
         <title><isprint value="${pageMetaTag.content}"/></title>
     <iselseif condition="${}">
         <meta name="<isprint value="${pageMetaTag.ID}">" content="<isprint value="${pageMetaTag.content}">">
     <iselseif condition="${}">
         <meta property="<isprint value="${pageMetaTag.ID}">" content="<isprint value="${pageMetaTag.content}">">

The following methods enable you to check if page meta tags are generated and perform fallback behavior:

 <isif condition="${!pdict.CurrentPageMetaData.isPageMetaTagSet('description')}">
     <meta name="description" content="Add here your fallback description!">

Related Links

Meta Tag Rules

Meta Tag Rules Syntax APIs

Creating Page Meta Tag Rules