Developer forum

Forum » CMS - Standard features » Item based page field value rendering on frontend

Item based page field value rendering on frontend

Aditya Bante
Reply

Hi 

I have an Item based page and a custom field on it (field type: Link) and I would like to render the fields value in a open graph meta tag.

So I made some variables 

@{ 
        var url = GetGlobalValue("Global:Request.Host");      
        var imagetag = GetString("Item.Page.TestLink.Value");
    }

and insert them into content of meta tag

<meta property="og:image" content='http://@url@imagetag' />

The problem is I am not sure if the tag for "var imagetag" is right, since it's not outputting the value. On source code it renders only the domain name not the tag value. see below.

<meta property="og:image" content='http://domain'>

Any suggestions ? is it the tag which is wrong.

BR
Aditya Bante

 

 


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

It depends on your setup if it is the right tag.

You can search your template tags and print a list of values like this:

@Templatetags("Item");

or

@Templatetags("TestLink");

The string you pass is what you want to search for in your tag collection.

BR Nicolai

Votes for this answer: 1
 
Aditya Bante
Reply

Got it. Thanks

 

You must be logged in to post in the forum