Guys,
It’s already possible to add dynamic meta tags to your pages. Select ‘App’ in the app structure, add new dynamic attribute and you will see the meta tags there, so you can bind dynamic data to them.
Unlike Google and modern search engines, Facebook and Twitter cannot read the dynamic meta tags added via app connect (they don’t read JavaScript values)
That’s why we’ve not added these in dynamic attributes.
I need to set the meta tags for Facebook linking so am checking if this is still the case that Facebook and Twitter cannot read dynamic content. What’s the technique for addressing this?
Facebook and Twitter require your og:tags to be rendered on the server side. If you are using nodejs, you can use server-side rendering for that.
For other server models, you will need to write custom code as server-side rendering is not available.
I have used the PHP code solution in this post effectively in the past.
Could proably do with a bit of an update to use $_ENV variables to hide the login credential which could be exposed on server error but the solution does work.
Hmmm, try checking ‘variables_order’ setting in your PHP ini file and make sure the setting includes an "E’ to define creation of $_ENV vars
Also check the output of getenv() from PHP which should list all $_ENV variables
Thanks Brian. Before I get myself into ini files, etc. Can you confirm the syntax for accessing env variables which are created in the Environment section of the server connect settings?
I used this PHP solution and it worked a treat.
One thing that Facebook seems to need is the image dimensions, so I had to add code to manage presenting that info too.
I believe you are correct, I confess I have never used ENV variables on php platform. <?PHP echo getenv(); ?>
Would be my first port of call.
(That’s the first line of php I have written on about 2 years!)
Otherwise probably need assistance from the oracle @patrick
My understanding is which globals are supported is defined in variables_order in the php.ini file.
If not defined (no E in string) then ENV variables are not created. Then again I am no expert on this and am unsure how wappler creates and manages ENV variables internally.