Dynamic Opengraph Meta Tags in a .NET site

Hi all,
Sheesh, this one has been difficult to work out - has anyone managed to get dynamic Opengraph meta tags to work on a .NET Windows server…?

My App Root is set to ‘Page’ and the main title tag is showing dynamic data when shared to Facebook but the rest are just showing the code, here’s what my code looks like:

<title>{{scMetaTags.data.querySeo.SeoTitle}} </title>
<meta name="og:site_name" dmx-text="scMetaTags.data.querySeo.SeoOgSitename">
<meta name="og:title" dmx-text="scMetaTags.data.querySeo.SeoOgTitle">

When I try to save it to FB here’s what it looks like:

Has anyone out there managed to get this to work correctly…?

Having dynamic Meta tags is important as one of our main sites is over 10,000 pages and will need to be automatically handled rather than handballing such a huge amount of data…

Unfortunately unlike Google and others, Facebook doesn’t parse the javascript expressions used in the meta tags of your page.
There are a few options available for you:

  • Use ASP/.NET code directly on the page instead of App Connect expressions in order to get the dynamic data there.
  • Use services like https://prerender.io/

Also i see your expressions are wrong.
These should be:

<meta property="og:title" dmx-bind:content="scMetaTags.data.querySeo.SeoOgTitle" />
<meta property="og:site_name" dmx-bind:content="scMetaTags.data.querySeo.SeoOgSitename" />

and not using dmx-text there.

Thanks for that fast reply @Teodor Id have never found that pretender link

I guess rather than having more DB calls for the ASP/.NET code the cleanest option will be the prerender option, I’ll get on this right away and start bashing away at it.

The expression fix is noted and again, much appreciated.!