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/
2 Likes

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.!

We spent a fair bit of time on this and its looking like we’re going to have to ditch .NET for anything we were hoping to build with Wappler.

prerender.io cheapest option is $90 per month but we’d probably end up on the $290 per month which is ridiculous. We also didn’t want to have to use Visual Studio as it would obviously negate the need to use Wappler for anything.

Anyone wishing to do even basic marketing for any website built using Wappler and .NET will find they cannot share to: Facebook, Twitter, Mastodon etc. This is a major flaw in what is essentially a great piece of software - its a massive let down to have to bin so much work for something so seemingly trivial.

If someone else has managed a workaround please post it.

Server-side rendering is only supported for NodeJS in Wappler.
There’s no server-side rendering support for PHP/ASP/ASP.NET and sites like Facebook, Twitter etc. do not render javascript expressions in meta tags such as: {{expression_here}} which are used on the front-end, so if you want to share your sites there with dynamic meta tags, then you need server-side rendering.

1 Like

Thanks for the update @Teodor - Will there be any way for Wappler to provide server side rendering in anything else other than NodeJS at any time in the future…?

All websites need to be marketed, those catering for B2C also need social media in all forms for effective marketing. Not having the ability to render dynamic data on social shares is a massive deal for everyone wishing to monetize their work.

Whilst NodeJS really is excellent, PHP/.NET have their advantages too, so it would be a real shame if they also couldn’t benefit from this.

I know this post is about PHP but there may be an equivalent in .net?
Sorry, never used .net so cant add more

1 Like

Thanks for that @Hyperbytes - its does indeed work for .NET but we’d have to pay $290 per month for the version we would need which makes no sense - that’s a lot of outlay for such a small service. Their cheapest offering is $90 per month which is still way too much.

No, I meant the coded version I.e. add some .net code into the page headers with runat=server rather than the pre-render service. Works a treat with php