Developer forum

Forum » Templates » Add custom meta tags

Add custom meta tags

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

In Swift 1, how do I add a custom meta tag? I tried this in ProductViewDetail.cshtml:

Pageview.Meta.AddTag("One", "The other");

But when the tags are then rendered in the master file using:

@Model.MetaTags

the new tag doesn't show up. 

It seems to work in Swift 2?

Imar
 

 

 


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Swift 1 on DW10 or DW9

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

I tried it on both and can't get it to work on either.

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Bump. Any idea on how to work around this?

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

I think in Swift 1 it is due to this component things - with a page rendering another page. So doing Pageview.Meta.AddTag in a paragraph that sits in a grid on one page and being rendered into another page, the Pageview.Meta.AddTag sets the tag of that other page that actually never renders.

So the template you have to do this in has to live in the context of the pageview showing the other grid...

Confused? I understand...

Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

I see, that makes sense. I'll find a work around...

 

You must be logged in to post in the forum