This project is read-only.

Get Vandelay description meta value in an Open Graph meta

Topics: General, Troubleshooting
Apr 29, 2013 at 11:45 AM
Edited Apr 29, 2013 at 11:45 AM
Hi there everyone,

I have installed the Vandelay Industries module and I am now able to enter meta descriptions in my pages, which is a really cool feature. However I have been asked to include an Open Graph meta containing this description.

I want to get the description value I have already provided and assign it to an Open Graph og:description

The way I would like to achieve that is to get the value on a per page basis like I can with the page title:
string title = Convert.ToString(Model.Title);
and then add it to a meta like so:
<meta property="og:title" content="@title"/>
Is this possible?

Thanks in advance
Apr 29, 2013 at 6:55 PM
Sure. Look at the code that creates the other meta tags, in Vandelay Industries and tweak it.
Apr 30, 2013 at 11:21 AM
Thanks for the prompt reply. I will certainly give it a go. However I want to ask, isn't there a way to store the description value in a variable, like I do with the title and then just code the meta in the document.cshtml file?
May 1, 2013 at 3:34 AM
Sure. I don't see the point, but yes, you can add dynamic properties to the Layout shape, for example, or in the HttpContext and then retrieve that from pretty much anywhere, including document.cshtml. But I don't understand why you wouldn't just take advantage of an API that is already there and designed for exactly that usage.
May 1, 2013 at 10:46 AM
I'll just give it a go then. Thank you again