Smile Posted February 25, 2020 Share Posted February 25, 2020 I am looking in a way to add: <meta name=”robots” content=”noindex,follow”/> on certain pages. I tried it with HTML Box pro but is toes not save this rule. Is there an other easy way to get this only added on certain pages in the header? Maybe an enhancement for next version? Link to comment Share on other sites More sharing options...
0 MichaelEZ Posted February 26, 2020 Share Posted February 26, 2020 (edited) well i use something like on index {if $page_name == 'index'} {/if} or for categories {if $page_name == 'category'} {if $smarty.get.id_category==1} {elseif $smarty.get.id_category==2} {elseif $smarty.get.id_category==3} {else} {/if} {/if} or for product via manufacturer {if ($page_name == 'product')} {if $product_manufacturer->id==1 } {elseif $product_manufacturer->id==2 } {elseif $product_manufacturer->id==3 } {else} {/if} {/if} and so on Edited February 26, 2020 by MichaelEZ 1 Link to comment Share on other sites More sharing options...
0 Smile Posted February 26, 2020 Author Share Posted February 26, 2020 Hmmmm, I am a rather noob in coding. I feel the direction you want to go. Not sure how to do this in my case. Link to comment Share on other sites More sharing options...
0 MichaelEZ Posted February 26, 2020 Share Posted February 26, 2020 As I am 😉 well u can go to your theme folder, find header.tpl and past code right there in meta tags, but on which pages do u want have that meta tag turned on? Link to comment Share on other sites More sharing options...
0 Smile Posted February 26, 2020 Author Share Posted February 26, 2020 Just search and quick-order so respectively I think: order-opc.tpl and search.tpl I guess... We use one page checkout. Link to comment Share on other sites More sharing options...
0 MichaelEZ Posted February 26, 2020 Share Posted February 26, 2020 (edited) Find meta tags in header.tpl and add : {if ($page_name == 'search')} <meta name=”robots” content=”noindex,follow”/> {/if} {if ($page_name == 'order-opc')} <meta name=”robots” content=”noindex,follow”/> {/if} Edited February 26, 2020 by MichaelEZ 1 Link to comment Share on other sites More sharing options...
0 Smile Posted February 26, 2020 Author Share Posted February 26, 2020 Ohh that easy! Very nice and helpful I learn step by step. Thank you! 1 Link to comment Share on other sites More sharing options...
0 Smile Posted February 28, 2020 Author Share Posted February 28, 2020 (edited) Just a small issue did arise... I got now double robots tags... Is there a way to solve this also in TB? Or do i have to exclude this one then on certain pages? Or are we missing some setting somewhere? This is generating the top line. {/if} <meta name="robots" content="{if isset($nobots)}no{/if}index,{if isset($nofollow) && $nofollow}no{/if}follow" /> Edited February 28, 2020 by Smile Link to comment Share on other sites More sharing options...
0 datakick Posted February 28, 2020 Share Posted February 28, 2020 4 hours ago, Smile said: Just a small issue did arise... I got now double robots tags... Is there a way to solve this also in TB? Or do i have to exclude this one then on certain pages? Or are we missing some setting somewhere? This is generating the top line. {/if} <meta name="robots" content="{if isset($nobots)}no{/if}index,{if isset($nofollow) && $nofollow}no{/if}follow" /> Include the top line into your expression. Something like this should do the trick {if ($page_name == 'search' || $page == 'order-opc')} <meta name=”robots” content=”noindex,follow” /> {else} <meta name="robots" content="{if isset($nobots)}no{/if}index,{if isset($nofollow) && $nofollow}no{/if}follow" /> {/if} Link to comment Share on other sites More sharing options...
0 Smile Posted February 29, 2020 Author Share Posted February 29, 2020 (edited) Thanks, this is a perfect solution! Just made a small fix: {if ($page_name == 'search' || $page_name == 'order-opc')} <meta name="robots" content="noindex,follow" /> {else} <meta name="robots" content="{if isset($nobots)}no{/if}index,{if isset($nofollow) && $nofollow}no{/if}follow" /> {/if} Edited February 29, 2020 by Smile Link to comment Share on other sites More sharing options...
Question
Smile
I am looking in a way to add:
on certain pages. I tried it with HTML Box pro but is toes not save this rule.
Is there an other easy way to get this only added on certain pages in the header? Maybe an enhancement for next version?
Link to comment
Share on other sites
9 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now