peterlu
10 years agoChampion
code snippet for social meta tags (open graph and twitter)
Hi All,
I am thinking sharing these codes that I have been using for ages. I hope it can help someone.
<#if page.name == "CommunityPage"> <meta property="og:title" content="${coreNode.title?html}"/> <meta property="og:description" content="Making it easier to join the conversation, get help, and share your thoughts."/> <#elseif page.name == "ForumTopicPage"> <meta property="og:title" content="${page.context.thread.topicMessage.subject?html} - ${community.title?html}"/> <meta property="og:description" content="I found this useful post on XXX Forum"/> </#if> <meta property="og:image" content="${asset.get("/html/assets/community-icon.png")}"/> <meta property="og:site_name" content="${community.title?html}"/> <meta property="og:type" content="website"/> <meta name="twitter:card" content="summary"/> <meta name="twitter:image" content="${asset.get("/html/assets/community-icon.png")}"/>
Hi peterlu
thanks for sharing. For information, if using the above (or similar custom tags) ode make sure that the Lithium Opengraph configuration is turned off (see more here), to avoid conflicting tags on the pages.
Cheers,