Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-9652

Add opengraph meta template

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.1.11
    • Fix Version/s: 4.4.0
    • Component/s: Plugin : Web
    • Labels:
      None
    • Internal review:
      2 - Long term
    • Estimation:
      2 - Normal

      Description

      https://developers.facebook.com/docs/sharing/webmasters

      This is a template suggestion to add OpenGraph meta

      <!-- + 
               | OPEN GRAPH META
               + -->
      	<xsl:template name="og-meta">	
      <!-- 		<xsl:comment> -->
      			<meta property="og:url" content="{resolver:resolve('page',ametys:pageId(),false(),true())}"/>
      			<!--
      				<xsl:element name="meta"><xsl:attribute name="property">og:title</xsl:attribute><xsl:attribute name="content"><xsl:call-template name="get-title"/></xsl:attribute></xsl:element>
      			 -->
      			<xsl:choose>								
      				<xsl:when test="/cms/page/pageContents/zone[@name = 'default']/zoneItem/html/head/meta[@name = 'DC.description']">
      	                <meta name="og:description" content="{/cms/page/pageContents/zone[@name = 'default']/zoneItem/html/head/meta[@name = 'DC.description']/@content}"/>
      	            </xsl:when>	
                  </xsl:choose>
      			<!-- Title of the first content -->
      			<xsl:for-each select="/cms/page/pageContents/zone[@name = 'default']/zoneItem[information/type = 'CONTENT'][1]/html/head">				
      					<meta property="og:title" content="{meta[@name = 'DC.title']/@content}" />									
      			</xsl:for-each>
      			<!-- Images of all contents -->
      			<xsl:for-each select="/cms/page/pageContents/zone[@name = 'default']/zoneItem[information/type = 'CONTENT']/html/head">			
      				<!-- illustration -->
      				<xsl:variable name="illustrationType" select="meta[@name = 'illustration/image;type']/@content"/>    
      		        <xsl:variable name="illustrationPath" select="meta[@name = 'illustration/image;path']/@content"/>			        
      		        <meta property="og:image" content="{resolver:resolveImage($illustrationType, concat($illustrationPath, '?objectId=', meta[@name = 'DC.identifier']/@content), 0, 1600,false(),true())}" />
      			</xsl:for-each>			
      <!-- 		</xsl:comment> -->		
      	</xsl:template>
      

      The idea here is to have all the images of the contents.
      You may improve the description to get the DC.description of the content and if empty to get the first x chars of the content (like in content digests).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                fravetier Frederic Ravetier
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: