Developer forum

Forum » Templates » Meta if Ecom
Peter Bille Larsen
Reply

Hi DWs

 

could it somehow be possible to make an IF statement in the master template, which makes a Meta insert, based on if the page shown is the product Card, and product Card only.?

 

any suggestions on this? :-)

 

Thanks

Peter


Replies

 
Mikkel Ricky
Reply
This post has been marked as an answer

You can use snippets (introduced in DW 8.2.2) for this:

In your product details template you insert something like

<!--@SnippetStart(meta)-->
<meta name="..." content="..."/>
<!--@SnippetEnd(meta)-->

and in your page/master template you insert

<!--@Snippet(meta)-->

Everything inside <!--@SnippetStart(meta)--> ... <!--@SnippetEnd(meta)--> will then be moved to where <!--@Snippet(meta)--> occurs. 

Best regards,
Mikkel


 

Votes for this answer: 1
 
Peter Bille Larsen
Reply

Great, that is really cool. I will use that on another client, which has a clean new solution.

 

I think this particular client I am trying to help, is running 8.1.1.5. I cannot upgrade just yet. Could there be some kind of solution to this software version?
8.1.1.5?

 

:-)

Thanks
Peter

 

 

 
Anders Ebdrup
Reply

Hi Peter,

 

I use this:

<!--@If(Global:Request.Query<contains>'productid')-->
<meta name="..." content="..."/>
<!--@EndIf-->

Best regards

 
Peter Bille Larsen
Reply

Hi Anders

 

That's a great technical solution. But I am not sure I would use productID, since that would force me to use a general product link on the shops like: Default.aspx?ID=10&ProductID=1001

but mb I can use a custom tag on a product, and test for content. I will stick with the snippet for now I guess. :-)

 

/thanks

 
Anders Ebdrup
Reply

Hi Peter

 

Even though you are using search engine friendly paths to the products you'll still have Global:Request.Query which will tell you the rewrited path.

 

E.g: "?ID=22&productid=M220000"

 

But I agree - if it is possible for you to use the snippets then go for it, my solution is just a hack :-)

 

Best regards, Anders

 
Peter Bille Larsen
Reply

ahh ok cool :-)  very cool.

 

thanks for the hack!

 

//Peter

 

 

 

 

 

 

 

 

You must be logged in to post in the forum