undefined
Skip to content
Moz logo Menu open Menu close
  • Products
    • Moz Pro
    • Moz Pro Home
    • Moz Local
    • Moz Local Home
    • STAT
    • Moz API
    • Moz API Home
    • Compare SEO Products
    • Moz Data
  • Free SEO Tools
    • Domain Analysis
    • Keyword Explorer
    • Link Explorer
    • Competitive Research
    • MozBar
    • More Free SEO Tools
  • Learn SEO
    • Beginner's Guide to SEO
    • SEO Learning Center
    • Moz Academy
    • MozCon
    • Webinars, Whitepapers, & Guides
  • Blog
  • Why Moz
    • Digital Marketers
    • Agency Solutions
    • Enterprise Solutions
    • Small Business Solutions
    • The Moz Story
    • New Releases
  • Log in
  • Log out
  • Products
    • Moz Pro

      Your all-in-one suite of SEO essentials.

    • Moz Local

      Raise your local SEO visibility with complete local SEO management.

    • STAT

      SERP tracking and analytics for enterprise SEO experts.

    • Moz API

      Power your SEO with our index of over 44 trillion links.

    • Compare SEO Products

      See which Moz SEO solution best meets your business needs.

    • Moz Data

      Power your SEO strategy & AI models with custom data solutions.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Free SEO Tools
    • Domain Analysis

      Get top competitive SEO metrics like DA, top pages and more.

    • Keyword Explorer

      Find traffic-driving keywords with our 1.25 billion+ keyword index.

    • Link Explorer

      Explore over 40 trillion links for powerful backlink data.

    • Competitive Research

      Uncover valuable insights on your organic search competitors.

    • MozBar

      See top SEO metrics for free as you browse the web.

    • More Free SEO Tools

      Explore all the free SEO tools Moz has to offer.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Learn SEO
    • Beginner's Guide to SEO

      The #1 most popular introduction to SEO, trusted by millions.

    • SEO Learning Center

      Broaden your knowledge with SEO resources for all skill levels.

    • On-Demand Webinars

      Learn modern SEO best practices from industry experts.

    • How-To Guides

      Step-by-step guides to search success from the authority on SEO.

    • Moz Academy

      Upskill and get certified with on-demand courses & certifications.

    • MozCon

      Save on Early Bird tickets and join us in London or New York City

    Unlock flexible pricing & new endpoints
    Moz API

    Unlock flexible pricing & new endpoints

    Find your plan
  • Blog
  • Why Moz
    • Digital Marketers

      Simplify SEO tasks to save time and grow your traffic.

    • Small Business Solutions

      Uncover insights to make smarter marketing decisions in less time.

    • Agency Solutions

      Earn & keep valuable clients with unparalleled data & insights.

    • Enterprise Solutions

      Gain a competitive edge in the ever-changing world of search.

    • The Moz Story

      Moz was the first & remains the most trusted SEO company.

    • New Releases

      Get the scoop on the latest and greatest from Moz.

    Surface actionable competitive intel
    New Feature

    Surface actionable competitive intel

    Learn More
  • Log in
    • Moz Pro
    • Moz Local
    • Moz Local Dashboard
    • Moz API
    • Moz API Dashboard
    • Moz Academy
  • Avatar
    • Moz Home
    • Notifications
    • Account & Billing
    • Manage Users
    • Community Profile
    • My Q&A
    • My Videos
    • Log Out

The Moz Q&A Forum

  • Forum
  • Questions
  • Users
  • Ask the Community

Welcome to the Q&A Forum

Browse the forum for helpful insights and fresh discussions about all things SEO.

  1. Home
  2. SEO Tactics
  3. Technical SEO
  4. Dynamically Inserting Noindex With Javascript

Moz Q&A is closed.

After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

Dynamically Inserting Noindex With Javascript

Technical SEO
2
6
1.7k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as question
Log in to reply
This topic has been deleted. Only users with question management privileges can see it.
  • Tom3_15
    Tom3_15 last edited by Nov 30, 2018, 4:37 PM

    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!

    1 Reply Last reply Reply Quote 0
    • JohnSammon
      JohnSammon last edited by Dec 4, 2018, 12:09 PM Dec 4, 2018, 12:09 PM

      Perfect! Happy to help!

      1 Reply Last reply Reply Quote 0
      • Tom3_15
        Tom3_15 @JohnSammon last edited by Dec 4, 2018, 11:32 AM Dec 4, 2018, 11:32 AM

        It seemed to work. Hopefully the noindex is respected, thank you!

        1 Reply Last reply Reply Quote 0
        • JohnSammon
          JohnSammon last edited by Dec 3, 2018, 12:01 PM Dec 3, 2018, 12:01 PM

          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.
          Tom3_15 1 Reply Last reply Dec 4, 2018, 11:32 AM Reply Quote 0
          • Tom3_15
            Tom3_15 @JohnSammon last edited by Dec 3, 2018, 11:53 AM Dec 3, 2018, 11:53 AM

            It looks like it is active. Thanks, John! Can you no-index an entire directory in GSC? I thought it was only per URL.

            1 Reply Last reply Reply Quote 0
            • JohnSammon
              JohnSammon last edited by Dec 3, 2018, 11:52 AM Dec 3, 2018, 10:47 AM

              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.

              Tom3_15 1 Reply Last reply Dec 3, 2018, 11:53 AM Reply Quote 1
              • 1 / 1
              1 out of 6
              • First post
                1/6
                Last post

              Got a burning SEO question?

              Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


              Start my free trial


              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.

              • See all categories

              Related Questions

              • williamhuynh

                Good to use disallow or noindex for these?

                technical seo noindex disallow

                Hello everyone, I am reaching out to seek your expert advice on a few technical SEO aspects related to my website. I highly value your expertise in this field and would greatly appreciate your insights.
                Below are the specific areas I would like to discuss: a. Double and Triple filter pages: I have identified certain URLs on my website that have a canonical tag pointing to the main /quick-ship page. These URLs are as follows: https://www.interiorsecrets.com.au/collections/lounge-chairs/quick-ship+black
                https://www.interiorsecrets.com.au/collections/lounge-chairs/quick-ship+black+fabric Considering the need to optimize my crawl budget, I would like to seek your advice on whether it would be advisable to disallow or noindex these pages. My understanding is that by disallowing or noindexing these URLs, search engines can avoid wasting resources on crawling and indexing duplicate or filtered content. I would greatly appreciate your guidance on this matter. b. Page URLs with parameters: I have noticed that some of my page URLs include parameters such as ?variant and ?limit. Although these URLs already have canonical tags in place, I would like to understand whether it is still recommended to disallow or noindex them to further conserve crawl budget. My understanding is that by doing so, search engines can prevent the unnecessary expenditure of resources on indexing redundant variations of the same content. I would be grateful for your expert opinion on this matter. Additionally, I would be delighted if you could provide any suggestions regarding internal linking strategies tailored to my website's structure and content. Any insights or recommendations you can offer would be highly valuable to me. Thank you in advance for your time and expertise in addressing these concerns. I genuinely appreciate your assistance. If you require any further information or clarification, please let me know. I look forward to hearing from you. Cheers!

                Technical SEO | Jul 17, 2023, 12:28 PM | williamhuynh
                0
              • btreloar

                Robots.txt Syntax for Dynamic URLs

                I want to Disallow certain dynamic pages in robots.txt and am unsure of the proper syntax. The pages I want to disallow all include the string ?Page= Which is the proper syntax?
                Disallow: ?Page=
                Disallow: ?Page=*
                Disallow: ?Page=
                Or something else?

                Technical SEO | Mar 29, 2017, 11:30 AM | btreloar
                0
              • Happy-SEO

                Images, CSS and Javascript on subdomain or external website

                Hi guy's, I came across webshops that put images, CSS and Javascript on different websites or subdomains. Does this boost SEO results? On our Wordpress webshop all the sourcescodes are placed after our own domainname: www.ourdomainname.com/wp-includes/js/jquery/jquery.js?ver=1.11.3'
                www.ourdomainname.com/wp-content/uploads/2015/09/example.jpg Examples of other website: Website 1:
                https://www.zalando.nl/heren-home/ Sourcecode:
                https://secure-i3.ztat.net//camp/03/d5/1a0168ac81f2ffb010803d108221.jpg
                https://secure-media.ztat.net/media/cms/adproduct/ad-product.min.css?_=1447764579000 Website 2:
                https://www.bol.com/nl/index.html Sourcecode:
                https://s.s-bol.com/nl/static/css/main/webselfservice.1358897755.css
                //s.s-bol.com/nl/upload/images/logos/bol-logo-500500.jpg Website 3: 
                http://www.wehkamp.nl/ Sourcecode:
                https://static.wehkamp.nl/assets/styles/themes/wehkamp.color.min.css?v=f47bf1
                http://assets.wehkamp.com/i/wehkamp/350-450-layer-SDD-wk51-v3.jpg

                Technical SEO | Feb 25, 2016, 12:32 PM | Happy-SEO
                0
              • Lvet

                JavaScript page loader - SEO impact

                Hello all,
                I am working on a site that has a bizarre page load system. All pages get loaded trough the same Javascript snippet, for example: Changing the values in the form changes the page that is loaded. The most incredible thing is that, against my expectations, pages do get indexed by Google.
                My question is: "Does loading pages dynamically using JavaScript affect the overall SEO performance?" Why are pages getting indexed? Thank you for shedding light on this.
                Cheers
                Luca

                Technical SEO | Feb 16, 2016, 9:17 PM | Lvet
                0
              • peterallen

                Setting title tag with javascript/jquery

                Hi there, I'm looking for some advice. I've recently implemented a few jQuery functions which gets specific content from the page and then sets the title and description. See working example here. It seems to work fine but my question I have is whether Google bots can read it and whether it might actually hinder my SEO efforts? Any advice would be really appreciated! Peter

                Technical SEO | Aug 14, 2013, 10:43 AM | peterallen
                0
              • CsmBill

                How do I add "noindex" or "nofollow" to a link in Wordpress

                It's been a while since I've SEOed a Wordpress site. How do I add "nofollow" or "noindex" to specific links? I highlight the anchor text in the text editor, I click the "link" button. I could have sworn that there used to be an option in the dialogue box that pops up.

                Technical SEO | Apr 23, 2013, 12:26 PM | CsmBill
                0
              • ChrisRoberts-MTI

                NoIndex/NoFollow pages showing up when doing a Google search using "Site:" parameter

                We recently launched a beta version of our new website in a subdomain of our existing site. The existing site is www.fonts.com with the beta living at new.fonts.com. We do not want Google to crawl the new site until it's out of beta so we have added the following on all pages: However, one of our team members noticed that google is displaying results from new.fonts.com when doing an "site:new.fonts.com" search (see attached screenshot). Is it possible that Google is indexing the content despite the noindex, nofollow tags? We have double checked the syntax and it seems correct except the trailing "/". I know Google still crawls noindexed pages, however, the fact that they're showing up in search results using the site search syntax is unsettling. Any thoughts would be appreciated! DyWRP.png

                Technical SEO | May 4, 2012, 7:08 PM | ChrisRoberts-MTI
                0
              • roundbrix

                Sitemap for dynamic website with over 10,000 pages

                If I have a website with thousands of products, is it a good idea to create a sitemap for this website for the search engines where you show maybe 250 products on a page so it makes it easy for the search engine to find the part and also puts that part closer to the home page? Seems like google likes pages that are the closest to the home page (less clicks the better)

                Technical SEO | Oct 26, 2011, 4:34 AM | roundbrix
                0

              Get started with Moz Pro!

              Unlock the power of advanced SEO tools and data-driven insights.

              Start my free trial
              Products
              • Moz Pro
              • Moz Local
              • Moz API
              • Moz Data
              • STAT
              • Product Updates
              Moz Solutions
              • SMB Solutions
              • Agency Solutions
              • Enterprise Solutions
              Free SEO Tools
              • Domain Authority Checker
              • Link Explorer
              • Keyword Explorer
              • Competitive Research
              • Brand Authority Checker
              • Local Citation Checker
              • MozBar Extension
              • MozCast
              Resources
              • Blog
              • SEO Learning Center
              • Help Hub
              • Beginner's Guide to SEO
              • How-to Guides
              • Moz Academy
              • API Docs
              About Moz
              • About
              • Team
              • Careers
              • Contact
              Why Moz
              • Case Studies
              • Testimonials
              Get Involved
              • Become an Affiliate
              • MozCon
              • Webinars
              • Practical Marketer Series
              • MozPod
              Connect with us

              Contact the Help team

              Join our newsletter
              Moz logo
              © 2021 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
              • Accessibility
              • Terms of Use
              • Privacy

              Looks like your connection to Moz was lost, please wait while we try to reconnect.