what should you do to incorporate opengraph and twitter cards in a 2sxc details template in c razor?

Using the docs from Jeremy, I put this into my C# razor template:

@using ToSic.Razor.Blade;

HtmlPage.AddOpenGraph("title", @Content.Name); 
HtmlPage.AddOpenGraph("type", "article");
HtmlPage.AddOpenGraph("url", @Dnn.Tab.FullUrl + "/career/" + Content.urlkey);
HtmlPage.AddOpenGraph("description", "need to determine description somehow");
HtmlPage.AddOpenGraph("image", "https://" + @Dnn.Portal.PortalAlias.HTTPAlias.Replace("/en-ca","").Replace("/fr-ca","") + @Content.Image + "?mode=crop&h=601&w=589&anchor=middlecenter");

This worked for both OpenGraph and TwitterCards.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top