Welcome to Vortx Community Forum, where you can ask questions and receive answers from the staff at Vortx and other members of the community.

If you had a user account on our previous forums website, you will need to register a new account here.

Learn more about...

AspDotNetStorefront
DotFeed

Block search engines from indexing manufacturers, vectors, genres, etc...

I would like to block Google from indexing manufacturers, vectors, genres, etc... I only want to index products...

Any help would be GREATLY appreciated.

Cheers,

D
asked Mar 20, 2015 in MultiStore by donato (870 points)

3 Answers

0 votes
I had a similar need a while back. I addressed it (v9.2) by changing the robots meta tag in my RootPage.master file to read "noindex,nofollow,noodp".

This has the effect of blacking out my entire site from indexing by search engines - which is itself undesirable.

I added code to each of the entity pages (showproduct.aspx.cs, showcategory.aspx.cs, etc.) that I wanted indexed. The code was added to the top of the Page_Load event; it examines the page's html headers and modifies the robots tag to read "index,follow,noodp". Because this happens during the Page_Load, the markup defined by the master file is never displayed to the search engines.

You may have to add soem assembly references to the entity code-behind, I think System.Web.UI.WebControls and System.Web.UI.HtmlControls should do it.

The code I added is in the first lines of the Page_Load event:

 

HtmlHead pHtml = Page.Header;

foreach(HtmlMeta metaTag in pHtml.Controls.OfType<HtmlMeta>())

{

metaTag.Content = metaTag.Name.Equals("robots", StringComparison.CurrentCultureIgnoreCase) ? "index,follow,noodp" : metaTag.Content;

}

 

Sorry for having to post the code as text, but these forums have crap support for pasting and code-handling with IE11 - pretty surprising for a site run by a .Net shop.

 

I don't know that this is the *best* way to handle this, since you'll need to add this code to every page that you want to enabled indexing for, but it works well for me.
answered Mar 20, 2015 by Chris (3,685 points)
0 votes
If were to do this I would make a 2nd master page with static meta tags and the use the template show overide appconfig where needed. For example genre, add the appconfig with the name of TemplateShowgenre.aspx and the value of 2nd master page filename. Save the new appconfig then reset chache the check if the changes made it it in properly.
answered Mar 20, 2015 by mmcgeachy (5,025 points)
0 votes

Depending on the version, you could even embed an XmlPackage in header for this and determine the page type adding block noindex/nofollow as needed.

Thank you,
Jan
 
Compunix, LLC (Phoenix, AZ)
AspDotNetStorefront Development Partner and Reseller since 2005
------------------------------------------------------------------------------------------------------
 AspDotNetStorefront add-ons and plugins : http://www.ecommercecartmods.com 
  * Searching Filtering, Single Signons, Reviews Ratings, Reports, Integrations
 
 Complete Automotive Solution : http://www.autopartsshoppingcart.com 
  * Auto + Aftermarket Parts solution
------------------------------------------------------------------------------------------------------
answered Mar 20, 2015 by jsimacek (6,805 points)
Jan,

How would you do that?

Thanks,

D

You can embed an XmlPackage in header by using this:

<asp:Literal ID="ltHeaderXmlPackage" runat="server" Text='<%$ Tokens:XmlPackage,headernofollow.xml.config %>' />

Then just make the  headernofollow.xml.config  with logic as needed...

Thank you,
Jan
 
Compunix, LLC (Phoenix, AZ)
AspDotNetStorefront Development Partner and Reseller since 2005
------------------------------------------------------------------------------------------------------
 AspDotNetStorefront add-ons and plugins : http://www.ecommercecartmods.com 
  * Searching Filtering, Single Signons, Reviews Ratings, Reports, Integrations
 
 Complete Automotive Solution : http://www.autopartsshoppingcart.com 
  * Auto + Aftermarket Parts solution
------------------------------------------------------------------------------------------------------
...