Dynamically Inserting Noindex With Javascript
-
Hello,
I have a broken plugin creating hundreds of WP-Content directory pages being indexed by Google. I can not access the source code of these pages to add a noindex to them. The page URL's all have the plugin name within them. In order to resolve the issue, I wrote a solution with javascript to dynamically add in a noindex tag to any URL containing the plugin name. Would this noindex be respected by Google and is there a way to immediately check that it is respected?
Currently, I can not delete the plugin due to issues with it's php.
If you would like to view the code: https://codepen.io/trodrick/pen/Gwwaej?editors=0010
Thanks!
-
Perfect! Happy to help!
-
It seemed to work. Hopefully the noindex is respected, thank you!
-
You can! Via https://support.google.com/webmasters/answer/1663419?hl=en
- If you choose to hide a directory, then any file or directory starting with the prefix you supply will be blocked. So if you enter /folder, then /folder/somefile, foldername/somefile, and /folder.html will all be blocked.
- To hide an entire site, leave the path empty.
-
It looks like it is active. Thanks, John! Can you no-index an entire directory in GSC? I thought it was only per URL.
-
Hey there! Do you have a link to a page where it's implemented live? As long as you have the no-index, no follow in there, you should be okay. Other things you can do:
1. Use robots.txt to hide the directory of pages that the plugin is outputting
2. Sign into the Google Search Console and no-index the same directory
I would do 1 and 2 to help speed up things once the no-index, no-follow tag is in place.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Noindex PPC landing pages or optimise for SEO?
Organic seems to be down YoY on one of the categories of a large ecommerce website that I work on. This particular category has multiple landing pages set up for PPC consisting of filtered products. So these landing pages are prone to duplicate content due to the products listed. e.g. Blue Thingamajigs White Thingamajigs Black Thingamajigs High Gloss Thingamajigs Oak Thingamajigs Glass Thingamajigs etc These landing pages do well for PPC, but are nowhere to be seen in organic (51+). The main category page however ranks quite well for quite a variety of root and longtail keywords, though not as well as it used to. For example, it does rank for "thingamajigs", "white thingamajigs", "white gloss thingamajigs" and "white gloss thingamajigs with cherries on top". Would it benefit the main category page if the PPC landing pages were noindexed? Or, despite Google's preference for the main category, work on further optimising the landing pages for SEO? Or is there another solution that I'm completely overlooking? (It is a Friday afternoon after all...)
Technical SEO | | Ria_0 -
301 Redirect Attribute-Based Dynamic URL to Renamed Attributes
I work with a number of ecommerce sites that have dynamically-created urls based off of product attributes we've assigned in our cms. I am updating a handful of these attributes to more seo-friendly terms because they are outdated but am not certain how to go about redirecting all the urls that each attribute is in/could be in. For example: If I had the attributes hoagie and beanie and changed them to sandwich and headwear, a dynamic url might change like this: .com/hoagie/french-bread ---> .com/sandwich/french-bread .com/beanie/hoagie/novelty ----> .com/headwear/sandwich/novelty Since the urls are dynamically created, I am not sure how I go about redirecting all of them, or if I need to redirect all of them at all (instead just redirecting the urls indexed by Google, etc.) I also have a number of links within copy on each of the sites that contain linked anchor text using attributes that will be changing. I am assuming I will need to 301 each of these or update them manually to reflect the new attributes. I am new to the seo field and would appreciate any and all advice or direction to guides and tutorials that could aid me with this project. Thanks!
Technical SEO | | OfficeFurn0 -
Different user experience with javascript on/off
I was wondered if the site is serving different user experience when JS is disabled is sort of cloaking
Technical SEO | | John_Smith_0 -
"INDEX,FOLLOW" then later in the code "NOINDEX,NOFOLLOW" which does google follow?
background info: we have an established closed E-commerce system which the company has been using for years. I have only just started and reviewing the system, I don't have direct access to the code, but can request changes, but it could take months before the changes are in effect (or done at all), and we won't can't change to a new E-commerce system for the short to mid term. While reviewing the site (with help of seomoz crawl diagnostics) I noticed that some of the existing "landing pages" have in the code: <meta name="<a class="attribute-value">robots</a>" content="<a class="attribute-value">INDEX,FOLLOW</a>" /> then a few lines later <meta name="<a class="attribute-value">robots</a>" content="<a class="attribute-value">NOINDEX,NOFOLLOW</a>" /> Which the crawl diagnostics flagged up, but in the webmaster tools says
Technical SEO | | PaddyDisplays
"We didn't detect any issues with non-indexable content on your site." so the question is which instructions does google follow? the first or 2nd? note: clearly this is need fixed, but I have a big list of changes for the system so I need to know how important this is tthanks0 -
"noindex" internal search result urls
Hi, Would applying "noindex" on any page (say internal search pages) or blocking via robots text, skew up the internal site search stats in Google Analytics? Thanks,
Technical SEO | | RaksG0 -
Why are pages still showing in SERPs, despite being NOINDEXed for months?
We have thousands of pages we're trying to have de-indexed in Google for months now. They've all got . But they simply will not go away in the SERPs. Here is just one example.... http://bitly.com/VutCFiIf you search this URL in Google, you will see that it is indexed, yet it's had for many months. This is just one example for thousands of pages, that will not get de-indexed. Am I missing something here? Does it have to do with using content="none" instead of content="noindex, follow"? Any help is very much appreciated.
Technical SEO | | MadeLoud0 -
Wordpress noindex
Hi there, Does anyone no of a way to noindex all the "previous entries" pages in a wordpress blog. They usally show on domain.com/page/2/ etc. They are the small snippets that provide a summary of the all your posts. I've not been able to find a plugin to do this. Thanks so much!
Technical SEO | | PeterM220 -
Should i use NoIndex, Follow & Rel=Canonical Tag In One Page?
I am having pagination problem with one of my clients site , So I am deciding to use noindex, follow tag for the Page 2,3,4 etc for not to have duplicated content issue, Because obviously SEOMoz Crawl Diagnostics showing me lot of duplicate page contents. And past 2 days i was in constant battle whether to use noindex, follow tag or rel=canonical tag for the Page 2,3,4 and after going through all the Q&A,None of them gives me crystal clear answer. So i thought "Why can't i use 2 of them together in one page"? Because I think (correct me if i am wrong) 1.noindex, follow is old and traditional way to battle with dup contents
Technical SEO | | DigitalJungle
2.rel=canonical is new way to battle with dup contents Reason to use 2 of them together is: Bot finds to the non-canonical page first and looks at the tag nofollow,index and he knows not to index that page,meantime he finds out that canonical url is something something according to the url given in the tag,NO? Help Please???0