Developer forum

Forum » Templates » Overriding meta data on certain pages

Overriding meta data on certain pages

Jonas Mersholm
Reply

Hi, how would we work around changing the meta data on only certain pages?

Ive tried data-settings="disableparsing:true" and then using a snippet, but the problem is that i cannot set a default that way, therefor we have to set the datas in every layout-file which is not the case.

 

How would we set a default which can be overrided in for example eCommerce to generate better, more seo-friendly descriptions dynamically for our products?

 

Thanks in advance

JM


Replies

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

Hi Jonas

I think you can set meta data from a template in Razor:

Dynamicweb.Frontend.PageView.Current.Meta.Title = "Some"
Dynamicweb.Frontend.PageView.Current.Meta.Add("Description", "Your desc...")
Dynamicweb.Frontend.PageView.Current.Meta.Add("Keywords", "Your desc...")
Votes for this answer: 1
 
Jonas Mersholm
Reply

Thank you Nicolai. Works like a charm.

 

You must be logged in to post in the forum