[Skip to main content](https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics#main-content)

[![Google Search Central](https://developers.google.com/static/search/images/google-search-central-logo.svg)](https://developers.google.com/search)

*   [Google Search Central](https://developers.google.com/search)
    

[Documentation](https://developers.google.com/search/docs)

*   SEO fundamentals
*   [Introduction](https://developers.google.com/search/docs)
    
*   [Search Essentials](https://developers.google.com/search/docs/essentials)
    
*   [SEO Starter Guide](https://developers.google.com/search/docs/fundamentals/seo-starter-guide)
    
*   [Optimizing for generative AI search](https://developers.google.com/search/docs/fundamentals/ai-optimization-guide)
    
*   [How Google Search Works](https://developers.google.com/search/docs/fundamentals/how-search-works)
    
*   [Do you need an SEO?](https://developers.google.com/search/docs/fundamentals/do-i-need-seo)
    

*   Crawling and indexing
*   [Sitemaps](https://developers.google.com/search/docs/crawling-indexing/sitemaps/overview)
    
*   [robots.txt](https://developers.google.com/search/docs/crawling-indexing/robots/intro)
    
*   [Meta tags](https://developers.google.com/search/docs/crawling-indexing/special-tags)
    
*   [Crawler management](https://developers.google.com/search/docs/crawling-indexing/ask-google-to-recrawl)
    
*   [Removals](https://developers.google.com/search/docs/crawling-indexing/control-what-you-share)
    
*   [Canonicalization](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls)
    
*   [Redirects](https://developers.google.com/search/docs/crawling-indexing/301-redirects)
    
*   [JavaScript SEO](https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics)
    

*   Ranking and search appearance
*   [Visual Elements gallery](https://developers.google.com/search/docs/appearance/visual-elements-gallery)
    
*   [Title links](https://developers.google.com/search/docs/appearance/title-link)
    
*   [Snippets](https://developers.google.com/search/docs/appearance/snippet)
    
*   [Images](https://developers.google.com/search/docs/appearance/google-images)
    
*   [Videos](https://developers.google.com/search/docs/appearance/video)
    
*   [Structured data](https://developers.google.com/search/docs/appearance/structured-data/search-gallery)
    
*   [Favicons](https://developers.google.com/search/docs/appearance/favicon-in-search)
    

*   Site-specific guides
*   [Ecommerce](https://developers.google.com/search/docs/specialty/ecommerce)
    
*   [International and multilingual sites](https://developers.google.com/search/docs/specialty/international)
    

*   Data analysis
*   [Get started with Search Console](https://developers.google.com/search/docs/monitor-debug/search-console-start)
    
*   [Debug traffic drops](https://developers.google.com/search/docs/monitor-debug/debugging-search-traffic-drops)
    
*   [Using Search Console and Google Analytics data for SEO](https://developers.google.com/search/docs/monitor-debug/google-analytics-search-console)
    
*   [Get started with Google Trends](https://developers.google.com/search/docs/monitor-debug/trends-start)
    

[Support](https://developers.google.com/search/help) [Blog](https://developers.google.com/search/blog) [What's new](https://developers.google.com/search/news)

*   [All updates](https://developers.google.com/search/news)
    
*   [Documentation updates](https://developers.google.com/search/updates)
    
*   [Ranking updates](https://status.search.google.com/products/rGHU1u87FJnkP6W2GwMi/history)
    
*   [New YouTube videos](https://www.youtube.com/channel/UCWf2ZlNsCGDS89VBF_awNvA)
    
*   [Recent podcast episodes](https://pod.link/1512522198)
    

[Events](https://developers.google.com/search/events) [Case studies](https://developers.google.com/search/case-studies)

/

*   English
*   Deutsch
*   Español
*   Español – América Latina
*   Français
*   Indonesia
*   Italiano
*   Polski
*   Português – Brasil
*   Tiếng Việt
*   Türkçe
*   Русский
*   العربيّة
*   हिंदी
*   ภาษาไทย
*   中文 – 简体
*   中文 – 繁體
*   日本語
*   한국어

Sign in

*   [Documentation](https://developers.google.com/search/docs)
    

[Search Console](https://goo.gle/searchconsole)

[![Google Search Central](https://developers.google.com/static/search/images/google-search-central-logo.svg)](https://developers.google.com/search)

*   [Google Search Central](https://developers.google.com/search)
    

*   [Documentation](https://developers.google.com/search/docs)
    *   More
*   [Support](https://developers.google.com/search/help)
    
*   [Blog](https://developers.google.com/search/blog)
    
*   [What's new](https://developers.google.com/search/news)
    *   More
*   [Events](https://developers.google.com/search/events)
    
*   [Case studies](https://developers.google.com/search/case-studies)
    

*   [Introduction](https://developers.google.com/search/docs)
    
*   Search Essentials
    
    *   [Overview](https://developers.google.com/search/docs/essentials)
        
    *   [Technical requirements](https://developers.google.com/search/docs/essentials/technical)
        
    *   [Spam policies](https://developers.google.com/search/docs/essentials/spam-policies)
        
    
*   SEO fundamentals
    
    *   [SEO Starter Guide](https://developers.google.com/search/docs/fundamentals/seo-starter-guide)
        
    *   [How Google Search works](https://developers.google.com/search/docs/fundamentals/how-search-works)
        
    *   [Creating helpful, reliable, people-first content](https://developers.google.com/search/docs/fundamentals/creating-helpful-content)
        
    *   Generative AI fundamentals
        
        *   [Optimizing for generative AI](https://developers.google.com/search/docs/fundamentals/ai-optimization-guide)
            
        *   [Guidance on using generative AI](https://developers.google.com/search/docs/fundamentals/using-gen-ai-content)
            
        
    *   [Maintaining your site's SEO](https://developers.google.com/search/docs/fundamentals/get-started)
        
    *   [Developer's guide to Search](https://developers.google.com/search/docs/fundamentals/get-started-developers)
        
    *   [Do you need an SEO?](https://developers.google.com/search/docs/fundamentals/do-i-need-seo)
        
    
*   Crawling and indexing
    
    *   [Overview](https://developers.google.com/search/docs/crawling-indexing)
        
    *   [File types Google can index](https://developers.google.com/search/docs/crawling-indexing/indexable-file-types)
        
    *   [URL structure](https://developers.google.com/search/docs/crawling-indexing/url-structure)
        
    *   [Links](https://developers.google.com/search/docs/crawling-indexing/links-crawlable)
        
    *   Sitemaps
        
        *   [Learn about sitemaps](https://developers.google.com/search/docs/crawling-indexing/sitemaps/overview)
            
        *   [Build and submit a sitemap](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap)
            
        *   [Manage sitemaps with sitemap index file](https://developers.google.com/search/docs/crawling-indexing/sitemaps/large-sitemaps)
            
        *   Sitemap extensions
            
            *   [Image sitemaps](https://developers.google.com/search/docs/crawling-indexing/sitemaps/image-sitemaps)
                
            *   [News sitemaps](https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap)
                
            *   [Video sitemaps and alternatives](https://developers.google.com/search/docs/crawling-indexing/sitemaps/video-sitemaps)
                
            *   [Combining sitemap extensions](https://developers.google.com/search/docs/crawling-indexing/sitemaps/combine-sitemap-extensions)
                
            
        
    *   Crawler management
        
        *   [Ask Google to recrawl your URLs](https://developers.google.com/search/docs/crawling-indexing/ask-google-to-recrawl)
            
        *   [Troubleshoot crawl errors](https://developers.google.com/search/docs/crawling-indexing/troubleshoot-crawling-errors)
            
        *   Google crawlers
            
            *   [List of Google crawlers](https://developers.google.com/crawling/docs/crawlers-fetchers/overview-google-crawlers)
                
            *   [Googlebot](https://developers.google.com/search/docs/crawling-indexing/googlebot)
                
            *   [Reduce the Google crawl rate](https://developers.google.com/crawling/docs/crawlers-fetchers/reduce-crawl-rate)
                
            *   [Verifying Googlebot and other Google crawlers](https://developers.google.com/crawling/docs/crawlers-fetchers/verifying-googlebot)
                
            
        
    *   robots.txt
        
        *   [Introduction to robots.txt](https://developers.google.com/search/docs/crawling-indexing/robots/intro)
            
        *   [How Google interprets the robots.txt specification](https://developers.google.com/crawling/docs/robots-txt/robots-txt-spec)
            
        
    *   Canonicalization
        
        *   [What is URL canonicalization](https://developers.google.com/search/docs/crawling-indexing/canonicalization)
            
        *   [How to specify a canonical URL with rel="canonical" and other methods](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls)
            
        *   [Fix canonicalization issues](https://developers.google.com/search/docs/crawling-indexing/canonicalization-troubleshooting)
            
        
    *   [Mobile site and mobile-first indexing](https://developers.google.com/search/docs/crawling-indexing/mobile/mobile-sites-mobile-first-indexing)
        
    *   AMP
        
        *   [AMP on Google Search guidelines](https://developers.google.com/search/docs/crawling-indexing/amp)
            
        *   [Understand how AMP works in search results](https://developers.google.com/search/docs/crawling-indexing/amp/about-amp)
            
        *   [Enhance AMP content](https://developers.google.com/search/docs/crawling-indexing/amp/enhance-amp)
            
        *   [Validate AMP content](https://developers.google.com/search/docs/crawling-indexing/amp/validate-amp)
            
        *   [Remove AMP content](https://developers.google.com/search/docs/crawling-indexing/amp/remove-amp)
            
        
    *   JavaScript
        
        *   [Understand the JavaScript SEO basics](https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics)
            
        *   [Fix search-related JavaScript problems](https://developers.google.com/search/docs/crawling-indexing/javascript/fix-search-javascript)
            
        *   [Fix lazy-loaded content](https://developers.google.com/search/docs/crawling-indexing/javascript/lazy-loading)
            
        *   [Dynamic rendering as a workaround](https://developers.google.com/search/docs/crawling-indexing/javascript/dynamic-rendering)
            
        
    *   Page and content metadata
        
        *   [Page metadata](https://developers.google.com/search/docs/crawling-indexing/valid-page-metadata)
            
        *   Meta tags
            
            *   [Meta tags and HTML attributes that Google supports](https://developers.google.com/search/docs/crawling-indexing/special-tags)
                
            *   [Robots meta tag, data-nosnippet, and X-Robots-Tag](https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag)
                
            *   [noindex](https://developers.google.com/search/docs/crawling-indexing/block-indexing)
                
            
        *   [rel attributes](https://developers.google.com/search/docs/crawling-indexing/qualify-outbound-links)
            
        
    *   Removals
        
        *   [Control what you share with Google](https://developers.google.com/search/docs/crawling-indexing/control-what-you-share)
            
        *   [Page removals](https://developers.google.com/search/docs/crawling-indexing/remove-information)
            
        *   [Image removals](https://developers.google.com/search/docs/crawling-indexing/prevent-images-on-your-page)
            
        *   [Redacted information](https://developers.google.com/search/docs/crawling-indexing/keep-redacted-information-out)
            
        
    *   Site moves and changes
        
        *   [Redirects and Google Search](https://developers.google.com/search/docs/crawling-indexing/301-redirects)
            
        *   Site moves
            
            *   [Changing your hosting](https://developers.google.com/search/docs/crawling-indexing/site-move-no-url-changes)
                
            *   [Move a site with URL changes](https://developers.google.com/search/docs/crawling-indexing/site-move-with-url-changes)
                
            
        *   [A/B testing](https://developers.google.com/search/docs/crawling-indexing/website-testing)
            
        *   [Temporarily pause or disable a website](https://developers.google.com/search/docs/crawling-indexing/pause-online-business)
            
        
    
*   Ranking and search appearance
    
    *   [Overview](https://developers.google.com/search/docs/appearance)
        
    *   [AI features](https://developers.google.com/search/docs/appearance/ai-features)
        
    *   [Byline dates](https://developers.google.com/search/docs/appearance/publication-dates)
        
    *   [Favicons](https://developers.google.com/search/docs/appearance/favicon-in-search)
        
    *   [Featured snippets](https://developers.google.com/search/docs/appearance/featured-snippets)
        
    *   [Flexible Sampling](https://developers.google.com/search/docs/appearance/flexible-sampling)
        
    *   [Google Discover](https://developers.google.com/search/docs/appearance/google-discover)
        
    *   [Images](https://developers.google.com/search/docs/appearance/google-images)
        
    *   Local features
        
        *   [Business details](https://developers.google.com/search/docs/appearance/establish-business-details)
            
        *   [Top Places List](https://developers.google.com/search/docs/appearance/top-places-list)
            
        *   [Opting out of local search results](https://support.google.com/webmasters/answer/3035947)
            
        
    *   Page experience
        
        *   [Understanding page experience](https://developers.google.com/search/docs/appearance/page-experience)
            
        *   [Core Web Vitals](https://developers.google.com/search/docs/appearance/core-web-vitals)
            
        *   [Interstitials and dialogs](https://developers.google.com/search/docs/appearance/avoid-intrusive-interstitials)
            
        *   [Get started with signed exchanges on Google Search](https://developers.google.com/search/docs/appearance/signed-exchange)
            
        
    *   [Preferred sources](https://developers.google.com/search/docs/appearance/preferred-sources)
        
    *   Ranking systems
        
        *   [A guide to Google Search ranking systems](https://developers.google.com/search/docs/appearance/ranking-systems-guide)
            
        *   [Reviews system](https://developers.google.com/search/docs/appearance/reviews-system)
            
        
    *   Ranking updates
        
        *   [List of ranking updates](https://status.search.google.com/products/rGHU1u87FJnkP6W2GwMi/history)
            
        *   [Core updates](https://developers.google.com/search/docs/appearance/core-updates)
            
        *   [Spam updates](https://developers.google.com/search/docs/appearance/spam-updates)
            
        
    *   [Site names](https://developers.google.com/search/docs/appearance/site-names)
        
    *   [Sitelinks](https://developers.google.com/search/docs/appearance/sitelinks)
        
    *   [Snippets](https://developers.google.com/search/docs/appearance/snippet)
        
    *   Structured data
        
        *   [Understand how structured data works](https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data)
            
        *   [Structured data general guidelines](https://developers.google.com/search/docs/appearance/structured-data/sd-policies)
            
        *   [Enriched search results](https://developers.google.com/search/docs/appearance/enriched-search-results)
            
        *   [Generate structured data with JavaScript](https://developers.google.com/search/docs/appearance/structured-data/generate-structured-data-with-javascript)
            
        *   Feature guides
            
            *   [All structured data features](https://developers.google.com/search/docs/appearance/structured-data/search-gallery)
                
            *   [Article](https://developers.google.com/search/docs/appearance/structured-data/article)
                
            *   [Book actions](https://developers.google.com/search/docs/appearance/structured-data/book)
                
            *   [Breadcrumb](https://developers.google.com/search/docs/appearance/structured-data/breadcrumb)
                
            *   [Carousel](https://developers.google.com/search/docs/appearance/structured-data/carousel)
                
            *   [Course list](https://developers.google.com/search/docs/appearance/structured-data/course)
                
            *   [Dataset](https://developers.google.com/search/docs/appearance/structured-data/dataset)
                
            *   [Discussion forum](https://developers.google.com/search/docs/appearance/structured-data/discussion-forum)
                
            *   [Education Q&A](https://developers.google.com/search/docs/appearance/structured-data/education-qa)
                
            *   [Employer aggregate rating](https://developers.google.com/search/docs/appearance/structured-data/employer-rating)
                
            *   [Fact check](https://developers.google.com/search/docs/appearance/structured-data/factcheck)
                
            *   [Event](https://developers.google.com/search/docs/appearance/structured-data/event)
                
            *   [FAQ](https://developers.google.com/search/docs/appearance/structured-data/faqpage)
                
            *   [Image metadata](https://developers.google.com/search/docs/appearance/structured-data/image-license-metadata)
                
            *   [Job posting](https://developers.google.com/search/docs/appearance/structured-data/job-posting)
                
            *   [Local business](https://developers.google.com/search/docs/appearance/structured-data/local-business)
                
            *   [Math solver](https://developers.google.com/search/docs/appearance/structured-data/math-solvers)
                
            *   [Movie carousel](https://developers.google.com/search/docs/appearance/structured-data/movie)
                
            *   [Organization](https://developers.google.com/search/docs/appearance/structured-data/organization)
                
            *   Shopping
                
                *   [Overview](https://developers.google.com/search/docs/appearance/structured-data/product)
                    
                *   [Product snippet](https://developers.google.com/search/docs/appearance/structured-data/product-snippet)
                    
                *   [Merchant listing](https://developers.google.com/search/docs/appearance/structured-data/merchant-listing)
                    
                *   [Variants](https://developers.google.com/search/docs/appearance/structured-data/product-variants)
                    
                *   [Loyalty program](https://developers.google.com/search/docs/appearance/structured-data/loyalty-program)
                    
                *   [Merchant return policy](https://developers.google.com/search/docs/appearance/structured-data/return-policy)
                    
                *   [Merchant shipping policy](https://developers.google.com/search/docs/appearance/structured-data/shipping-policy)
                    
                
            *   [Profile page](https://developers.google.com/search/docs/appearance/structured-data/profile-page)
                
            *   [Q&A](https://developers.google.com/search/docs/appearance/structured-data/qapage)
                
            *   [Recipe](https://developers.google.com/search/docs/appearance/structured-data/recipe)
                
            *   [Review snippet](https://developers.google.com/search/docs/appearance/structured-data/review-snippet)
                
            *   [Software app](https://developers.google.com/search/docs/appearance/structured-data/software-app)
                
            *   [Speakable](https://developers.google.com/search/docs/appearance/structured-data/speakable)
                
            *   [Subscription and paywalled content](https://developers.google.com/search/docs/appearance/structured-data/paywalled-content)
                
            *   [Vacation rental](https://developers.google.com/search/docs/appearance/structured-data/vacation-rental)
                
            *   [Video](https://developers.google.com/search/docs/appearance/structured-data/video)
                
            
        
    *   [Title links](https://developers.google.com/search/docs/appearance/title-link)
        
    *   Translated features
        
        *   [Translated results](https://developers.google.com/search/docs/appearance/translated-results)
            
        *   [Ad networks and translation-related Google Search features](https://developers.google.com/search/docs/appearance/ad-network-and-translation)
            
        
    *   [Videos](https://developers.google.com/search/docs/appearance/video)
        
    *   [Visual Elements gallery](https://developers.google.com/search/docs/appearance/visual-elements-gallery)
        
    *   Web Stories
        
        *   [Enable Web Stories on Google](https://developers.google.com/search/docs/appearance/enable-web-stories)
            
        *   [Best practices for creating Web Stories](https://developers.google.com/search/docs/appearance/web-stories-creation-best-practices)
            
        *   [Web Story content policy](https://developers.google.com/search/docs/appearance/web-stories-content-policy)
            
        
    *   Early Adopters Program
        
        *   [Package tracking](https://developers.google.com/search/docs/appearance/package-tracking)
            
        *   [Structured data carousels (beta)](https://developers.google.com/search/docs/appearance/structured-data/carousels-beta)
            
        
    
*   Monitoring and debugging
    
    *   [Debug drops in Search traffic](https://developers.google.com/search/docs/monitor-debug/debugging-search-traffic-drops)
        
    *   Monitor with Search Console
        
        *   [Get started with Search Console](https://developers.google.com/search/docs/monitor-debug/search-console-start)
            
        *   [Improve SEO with a bubble chart](https://developers.google.com/search/docs/monitor-debug/bubble-chart-analysis)
            
        *   [Using Search Console and Google Analytics data for SEO](https://developers.google.com/search/docs/monitor-debug/google-analytics-search-console)
            
        
    *   Debug with search operators
        
        *   [Overview](https://developers.google.com/search/docs/monitor-debug/search-operators)
            
        *   [site: search operator](https://developers.google.com/search/docs/monitor-debug/search-operators/all-search-site)
            
        *   [Google Images search operators](https://developers.google.com/search/docs/monitor-debug/search-operators/image-search)
            
        
    *   Preventing and monitoring abuse
        
        *   [Overview](https://developers.google.com/search/docs/monitor-debug/security)
            
        *   [Prevent user-generated spam](https://developers.google.com/search/docs/monitor-debug/prevent-abuse)
            
        *   [Malware and unwanted software](https://developers.google.com/search/docs/monitor-debug/security/malware)
            
        *   [Prevent a malware infection](https://developers.google.com/search/docs/monitor-debug/security/prevent-malware)
            
        *   [Social engineering (phishing and deceptive sites)](https://developers.google.com/search/docs/monitor-debug/security/social-engineering)
            
        *   [Google Safe Browsing Repeat Offenders Policy](https://developers.google.com/search/docs/monitor-debug/security/safe-browsing-repeat-offenders)
            
        
    *   [Get started with Google Trends](https://developers.google.com/search/docs/monitor-debug/trends-start)
        
    
*   Site-specific guides
    
    *   Ecommerce
        
        *   [Overview](https://developers.google.com/search/docs/specialty/ecommerce)
            
        *   [Where content can appear](https://developers.google.com/search/docs/specialty/ecommerce/where-ecommerce-data-can-appear-on-google)
            
        *   [Share product data](https://developers.google.com/search/docs/specialty/ecommerce/share-your-product-data-with-google)
            
        *   [Include structured data](https://developers.google.com/search/docs/specialty/ecommerce/include-structured-data-relevant-to-ecommerce)
            
        *   [Launch a new website](https://developers.google.com/search/docs/specialty/ecommerce/how-to-launch-an-ecommerce-website)
            
        *   [Write high quality reviews](https://developers.google.com/search/docs/specialty/ecommerce/write-high-quality-reviews)
            
        *   [Design a URL structure](https://developers.google.com/search/docs/specialty/ecommerce/designing-a-url-structure-for-ecommerce-sites)
            
        *   [Ecommerce site structure](https://developers.google.com/search/docs/specialty/ecommerce/help-google-understand-your-ecommerce-site-structure)
            
        *   [Pagination, incremental page loading, and Search](https://developers.google.com/search/docs/specialty/ecommerce/pagination-and-incremental-page-loading)
            
        
    *   International and multilingual
        
        *   [Overview](https://developers.google.com/search/docs/specialty/international)
            
        *   [Managing multi-regional and multilingual sites](https://developers.google.com/search/docs/specialty/international/managing-multi-regional-sites)
            
        *   [Tell Google about localized versions of your page](https://developers.google.com/search/docs/specialty/international/localized-versions)
            
        *   [How Google crawls locale-adaptive pages](https://developers.google.com/search/docs/specialty/international/locale-adaptive-pages)
            
        
    *   Explicit content
        
        *   [Guidelines for sites with explicit content](https://developers.google.com/search/docs/specialty/explicit/guidelines)
            
        *   [What to do if your site is incorrectly flagged as explicit](https://developers.google.com/search/docs/specialty/explicit/troubleshooting)
            
        
    

*   SEO fundamentals
*   [Introduction](https://developers.google.com/search/docs)
    
*   [Search Essentials](https://developers.google.com/search/docs/essentials)
    
*   [SEO Starter Guide](https://developers.google.com/search/docs/fundamentals/seo-starter-guide)
    
*   [Optimizing for generative AI search](https://developers.google.com/search/docs/fundamentals/ai-optimization-guide)
    
*   [How Google Search Works](https://developers.google.com/search/docs/fundamentals/how-search-works)
    
*   [Do you need an SEO?](https://developers.google.com/search/docs/fundamentals/do-i-need-seo)
    
*   Crawling and indexing
*   [Sitemaps](https://developers.google.com/search/docs/crawling-indexing/sitemaps/overview)
    
*   [robots.txt](https://developers.google.com/search/docs/crawling-indexing/robots/intro)
    
*   [Meta tags](https://developers.google.com/search/docs/crawling-indexing/special-tags)
    
*   [Crawler management](https://developers.google.com/search/docs/crawling-indexing/ask-google-to-recrawl)
    
*   [Removals](https://developers.google.com/search/docs/crawling-indexing/control-what-you-share)
    
*   [Canonicalization](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls)
    
*   [Redirects](https://developers.google.com/search/docs/crawling-indexing/301-redirects)
    
*   [JavaScript SEO](https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics)
    
*   Ranking and search appearance
*   [Visual Elements gallery](https://developers.google.com/search/docs/appearance/visual-elements-gallery)
    
*   [Title links](https://developers.google.com/search/docs/appearance/title-link)
    
*   [Snippets](https://developers.google.com/search/docs/appearance/snippet)
    
*   [Images](https://developers.google.com/search/docs/appearance/google-images)
    
*   [Videos](https://developers.google.com/search/docs/appearance/video)
    
*   [Structured data](https://developers.google.com/search/docs/appearance/structured-data/search-gallery)
    
*   [Favicons](https://developers.google.com/search/docs/appearance/favicon-in-search)
    
*   Site-specific guides
*   [Ecommerce](https://developers.google.com/search/docs/specialty/ecommerce)
    
*   [International and multilingual sites](https://developers.google.com/search/docs/specialty/international)
    
*   Data analysis
*   [Get started with Search Console](https://developers.google.com/search/docs/monitor-debug/search-console-start)
    
*   [Debug traffic drops](https://developers.google.com/search/docs/monitor-debug/debugging-search-traffic-drops)
    
*   [Using Search Console and Google Analytics data for SEO](https://developers.google.com/search/docs/monitor-debug/google-analytics-search-console)
    
*   [Get started with Google Trends](https://developers.google.com/search/docs/monitor-debug/trends-start)
    

*   [All updates](https://developers.google.com/search/news)
    
*   [Documentation updates](https://developers.google.com/search/updates)
    
*   [Ranking updates](https://status.search.google.com/products/rGHU1u87FJnkP6W2GwMi/history)
    
*   [New YouTube videos](https://www.youtube.com/channel/UCWf2ZlNsCGDS89VBF_awNvA)
    
*   [Recent podcast episodes](https://pod.link/1512522198)
    

*   [Home](https://developers.google.com/)
    
*   [Search Central](https://developers.google.com/search)
    
*   [Documentation](https://developers.google.com/search/docs)
    

Send feedback

Understand the JavaScript SEO basics
====================================

Do you suspect that JavaScript issues might be blocking your page or some of your content from showing up in Google Search? Learn how to fix JavaScript-related problems with our [troubleshooting guide](https://developers.google.com/search/docs/guides/fix-search-javascript)
.

JavaScript is an important part of the web platform because it provides many features that turn the web into a powerful application platform. Making your JavaScript-powered web applications discoverable via Google Search can help you find new users and re-engage existing users as they search for the content your web app provides. While Google Search runs JavaScript with an [evergreen version of Chromium](https://developers.google.com/search/blog/2019/05/the-new-evergreen-googlebot)
, there are [a few things that you can optimize](https://developers.google.com/search/docs/guides/fix-search-javascript)
.

This guide describes how Google Search processes JavaScript and best practices for improving JavaScript web apps for Google Search.

How Google processes JavaScript
-------------------------------

Google processes JavaScript web apps in three main phases:

1.  Crawling
2.  Rendering
3.  Indexing

![Googlebot takes a URL from the crawl queue,\
crawls it, then passes it into the processing stage. The processing stage extracts links that\
go back on the crawl queue and queues the page for rendering. The page goes from the render\
queue to the renderer which passes the rendered HTML back to processing which indexes the content\
and extracts links to put them into the crawl queue.](https://developers.google.com/static/search/docs/images/googlebot-crawl-render-index.png)

Googlebot queues pages for both crawling and rendering. It is not immediately obvious when a page is waiting for crawling and when it is waiting for rendering. When Googlebot fetches a URL from the crawling queue by making an HTTP request, it first checks if you allow crawling. Googlebot reads the [robots.txt](https://developers.google.com/search/reference/robots_txt)
 file. If it marks the URL as disallowed, then Googlebot skips making an HTTP request to this URL and skips the URL. Google Search won't render JavaScript from blocked files or on blocked pages.

Googlebot then parses the response for other URLs in the `href` attribute of HTML links and adds the URLs to the crawl queue. To prevent link discovery, use the [`nofollow` mechanism](https://developers.google.com/search/docs/crawling-indexing/qualify-outbound-links)
.

It's fine to use JavaScript to inject links into the DOM, as long as such links follow the [best practices for crawlable links](https://developers.google.com/search/docs/crawling-indexing/links-crawlable#crawlable-links)
.

Crawling a URL and parsing the HTML response works well for classical websites or server-side rendered pages where the HTML in the HTTP response contains all content. Some JavaScript sites may use the [app shell model](https://developers.google.com/web/fundamentals/architecture/app-shell)
 where the initial HTML does not contain the actual content and Google needs to execute JavaScript before being able to see the actual page content that JavaScript generates.

Googlebot queues all pages with a `200` HTTP status code for rendering, unless a [robots `meta` tag or header](https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag)
 tells Google not to index the page. The page may stay on this queue for a few seconds, but it can take longer than that. Once Google's resources allow, a headless Chromium renders the page and executes the JavaScript. Googlebot parses the rendered HTML for links again and queues the URLs it finds for crawling. Google also uses the rendered HTML to index the page.

All pages with a `200` HTTP status code are sent to the rendering queue, no matter whether JavaScript is present on the page. If the HTTP status code is non-`200` (for example, on error pages with `404` status code), rendering might be skipped.

Keep in mind that [server-side or pre-rendering](https://developers.google.com/web/updates/2019/02/rendering-on-the-web)
 is still a great idea because it makes your website faster for users and crawlers, and not all bots can run JavaScript.

Describe your page with unique titles and snippets
--------------------------------------------------

Unique, descriptive [`<title>` elements](https://developers.google.com/search/docs/appearance/title-link#page-titles)
 and [meta descriptions](https://developers.google.com/search/docs/appearance/snippet#meta-descriptions)
 help users quickly identify the best result for their goal. You can use JavaScript to set or change the meta description as well as the `<title>` element.

Set the canonical URL
---------------------

The [`rel="canonical"` link tag](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls#rel-canonical-link-method)
 helps Google find the canonical version of a page. You can use JavaScript to set the canonical URL, but keep in mind that you shouldn't use JavaScript to change the canonical URL to something else than the URL you specified as the canonical URL in the original HTML. The best way to set the canonical URL is to use HTML, but if you have to use JavaScript, make sure that you always set the canonical URL to the same value as the original HTML. If you can't set the canonical URL in the HTML, then you can use JavaScript to set the canonical URL and leave it out of the original HTML.

Write compatible code
---------------------

Browsers offer many APIs and JavaScript is a quickly-evolving language. Google has some limitations regarding which APIs and JavaScript features it supports. To make sure your code is compatible with Google, follow our [guidelines for troubleshooting JavaScript problems](https://developers.google.com/search/docs/guides/fix-search-javascript)
.

We recommend [using differential serving and polyfills](https://web.dev/articles/codelab-serve-modern-code)
 if you feature-detect a missing browser API that you need. Since some browser features cannot be polyfilled, we recommend that you check the polyfill documentation for potential limitations.

Use meaningful HTTP status codes
--------------------------------

Googlebot uses [HTTP status codes](https://developers.google.com/search/docs/crawling-indexing/http-network-errors)
 to find out if something went wrong when crawling the page.

To tell Googlebot if a page can't be crawled or indexed, use a meaningful status code, like a `404` for a page that could not be found or a `401` code for pages behind a login. You can use HTTP status codes to tell Googlebot if a page has moved to a new URL, so that the index can be updated accordingly.

Here's a [list of HTTP status codes](https://developers.google.com/search/docs/crawling-indexing/http-network-errors#http-status-codes)
 and how they effect Google Search.

### Avoid `soft 404` errors in single-page apps

In client-side rendered single-page apps, routing is often implemented as client-side routing. In this case, using meaningful HTTP status codes can be impossible or impractical. To avoid [`soft 404` errors](https://developers.google.com/search/docs/crawling-indexing/troubleshoot-crawling-errors#soft-404-errors)
 when using client-side rendering and routing, use one of the following strategies:

*   Use a [JavaScript redirect](https://developers.google.com/search/docs/crawling-indexing/301-redirects#jslocation)
     to a URL for which the server responds with a `404` HTTP status code (for example `/not-found`).
*   Add a `<meta name="robots" content="noindex">` to error pages using JavaScript.

Here is sample code for the redirect approach:

fetch(\`/api/products/${productId}\`)
.then(response \=> response.json())
.then(product \=> {
  if(product.exists) {
    showProductDetails(product); // shows the product information on the page
  } else {
    // this product does not exist, so this is an error page.
    window.location.href \= '/not-found'; // redirect to 404 page on the server.
  }
})

Here is sample code for the `noindex` tag approach:

fetch(\`/api/products/${productId}\`)
.then(response \=> response.json())
.then(product \=> {
  if(product.exists) {
    showProductDetails(product); // shows the product information on the page
  } else {
    // this product does not exist, so this is an error page.
    // Note: This example assumes there is no other robots meta tag present in the HTML.
    const metaRobots \= document.createElement('meta');
    metaRobots.name \= 'robots';
    metaRobots.content \= 'noindex';
    document.head.appendChild(metaRobots);
  }
})

Use the History API instead of fragments
----------------------------------------

Google can only discover your links if they are [`<a>` HTML elements with an `href` attribute](https://developers.google.com/search/docs/crawling-indexing/links-crawlable)
.

For single-page applications with client-side routing, use the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History)
 to implement routing between different views of your web app. To ensure that Googlebot can parse and extract your URLs, don't use fragments to load different page content. The following example is a bad practice, because Googlebot can't reliably resolve the URLs:

<nav\>
  <ul\>
    <li><a href\="#/products"\>Our products</a\></li\>
    <li><a href\="#/services"\>Our services</a\></li\>
  </ul\>
</nav\>

<h1>Welcome to example.com!</h1\>
<div id\="placeholder"\>
  <p>Learn more about <a href\="#/products"\>our products</a\> and <a href\="#/services"\>our services</a\></p\>
</div\>
<script\>
window.addEventListener('hashchange', function goToPage() {
  // this function loads different content based on the current URL fragment
  const pageToLoad \= window.location.hash.slice(1); // URL fragment
  document.getElementById('placeholder').innerHTML \= load(pageToLoad);
});
</script\>

Instead, you can make sure your URLs are accessible to Googlebot by implementing the History API:

<nav\>
  <ul\>
    <li><a href\="/products"\>Our products</a\></li\>
    <li><a href\="/services"\>Our services</a\></li\>
  </ul\>
</nav\>

<h1>Welcome to example.com!</h1\>
<div id\="placeholder"\>
  <p>Learn more about <a href\="/products"\>our products</a\> and <a href\="/services"\>our services</a\></p\>
</div\>
<script\>
function goToPage(event) {
  event.preventDefault(); // stop the browser from navigating to the destination URL.
  const hrefUrl \= event.target.getAttribute('href');
  const pageToLoad \= hrefUrl.slice(1); // remove the leading slash
  document.getElementById('placeholder').innerHTML \= load(pageToLoad);
  window.history.pushState({}, window.title, hrefUrl) // Update URL as well as browser history.
}

// Enable client-side routing for all links on the page
document.querySelectorAll('a').forEach(link \=> link.addEventListener('click', goToPage));

</script\>

Properly inject the `rel="canonical"` link tag
----------------------------------------------

While we don't recommend using JavaScript for this, it is possible to inject a [`rel="canonical"` link tag](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls#rel-canonical-link-method)
 with JavaScript. Google Search will pick up the injected canonical URL when rendering the page. Here is an example to inject a `rel="canonical"` link tag with JavaScript:

fetch('/api/cats/' + id)
  .then(function (response) { return response.json(); })
  .then(function (cat) {
    // creates a canonical link tag and dynamically builds the URL
    // e.g. https://example.com/cats/simba
    const linkTag \= document.createElement('link');
    linkTag.setAttribute('rel', 'canonical');
    linkTag.href \= 'https://example.com/cats/' + cat.urlFriendlyName;
    document.head.appendChild(linkTag);
  });

When using JavaScript to inject the `rel="canonical"` link tag, make sure that this is the only `rel="canonical"` link tag on the page. Incorrect implementations might create multiple `rel="canonical"` link tag or change an existing `rel="canonical"` link tag. Conflicting or multiple `rel="canonical"` link tags may lead to unexpected results.

Use robots `meta` tags carefully
--------------------------------

You can prevent Google from indexing a page or following links through the robots `meta` tag. For example, adding the following `meta` tag to the top of your page blocks Google from indexing the page:

<!-- Google won't index this page or follow links on this page \--\>
<meta name\="robots" content\="noindex, nofollow"\>

You can use JavaScript to add a robots `meta` tag to a page or change its content. The following example code shows how to change the robots `meta` tag with JavaScript to prevent indexing of the current page if an API call doesn't return content.

fetch('/api/products/' + productId)
  .then(function (response) { return response.json(); })
  .then(function (apiResponse) {
    if (apiResponse.isError) {
      // get the robots `meta` tag
      var metaRobots \= document.querySelector('meta\[name="robots"\]');
      // if there was no robots `meta` tag, add one
      if (!metaRobots) {
        metaRobots \= document.createElement('meta');
        metaRobots.setAttribute('name', 'robots');
        document.head.appendChild(metaRobots);
      }
      // tell Google to exclude this page from the index
      metaRobots.setAttribute('content', 'noindex');
      // display an error message to the user
      errorMsg.textContent \= 'This product is no longer available';
      return;
    }
    // display product information
    // ...
  });

When Google encounters the `noindex` tag, it may skip rendering and JavaScript execution, which means using JavaScript to change or remove the robots `meta` tag from `noindex` may not work as expected. If you _do_ want the page indexed, don't use a `noindex` tag in the original page code.

Use long-lived caching
----------------------

Googlebot caches aggressively in order to reduce network requests and resource usage. WRS may ignore caching headers. This may lead WRS to use outdated JavaScript or CSS resources. Content fingerprinting avoids this problem by making a fingerprint of the content part of the filename, like `main.2bb85551.js`. The fingerprint depends on the content of the file, so updates generate a different filename every time. Check out the [web.dev guide on long-lived caching strategies](https://web.dev/articles/http-cache#versioned-urls)
 to learn more.

Use structured data
-------------------

When using [structured data](https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data)
 on your pages, you can use [JavaScript to generate the required JSON-LD and inject it into the page](https://developers.google.com/search/docs/guides/generate-structured-data-with-javascript#testing)
. Make sure to [test your implementation](https://developers.google.com/search/docs/guides/debug)
 to avoid issues.

Follow best practices for web components
----------------------------------------

Google supports web components. When Google renders a page, it [flattens the shadow DOM and light DOM](https://developers.google.com/web/fundamentals/web-components/shadowdom#lightdom)
 content. This means Google can only see content that's visible in the rendered HTML. To make sure that Google can still see your content after it's rendered, use the [Rich Results Test](https://search.google.com/test/rich-results)
 or the [URL Inspection Tool](https://support.google.com/webmasters/answer/9012289)
 and look at the rendered HTML.

If the content isn't visible in the rendered HTML, Google won't be able to index it.

The following example creates a web component that displays its light DOM content inside its shadow DOM. One way to make sure both light DOM and shadow DOM content is displayed in the rendered HTML is to use a [Slot](https://developers.google.com/web/fundamentals/web-components/shadowdom#slots)
 element.

<script>
  class MyComponent extends HTMLElement {
    constructor() {
      super();
      this.attachShadow({ mode: 'open' });
    }

    connectedCallback() {
      let p = document.createElement('p');
      p.innerHTML = 'Hello World, this is shadow DOM content. Here comes the light DOM: <slot></slot>';
      this.shadowRoot.appendChild(p);
    }
  }

  window.customElements.define('my-component', MyComponent);
</script>

<my-component>
  <p>This is light DOM content. It's projected into the shadow DOM.</p>
  <p>WRS renders this content as well as the shadow DOM content.</p>
</my-component>

After rendering, Google can index this content:

<my-component>
  Hello World, this is shadow DOM content. Here comes the light DOM:
  <p>This is light DOM content. It's projected into the shadow DOM<p>
  <p>WRS renders this content as well as the shadow DOM content.</p>
</my-component>
    

Fix images and lazy-loaded content
----------------------------------

Images can be quite costly on bandwidth and performance. A good strategy is to use lazy-loading to only load images when the user is about to see them. To make sure you're implementing lazy-loading in a search-friendly way, follow [our lazy-loading guidelines](https://developers.google.com/search/docs/guides/lazy-loading)
.

Send feedback

Except as otherwise noted, the content of this page is licensed under the [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/)
, and code samples are licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0)
. For details, see the [Google Developers Site Policies](https://developers.google.com/site-policies)
. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-03-04 UTC.

 *    [![LinkedIn](https://developers.google.com/static/search/images/li.png)LinkedIn](https://www.linkedin.com/showcase/googlesearchcentral/)
    
    Join us on LinkedIn
    
*    [![YouTube](https://developers.google.com/static/homepage-assets/images/yt.svg)YouTube](https://www.youtube.com/channel/UCWf2ZlNsCGDS89VBF_awNvA)
    
    Watch our videos
    
*    [![Blog](https://fonts.gstatic.com/s/i/short-term/release/googlesymbols/rss_feed/default/24px.svg)Blog](https://feeds.feedburner.com/blogspot/amDG)
    
    Subscribe to our RSS feed
    
*    [![Podcast](https://developers.google.com/static/search/images/search-off-the-record-podcast-logo.png)Podcast](https://pod.link/1512522198)
    
    Listen to Search Off the Record
    
*    [![X (Twitter)](https://developers.google.com/static/homepage-assets/images/x.svg)X (Twitter)](https://twitter.com/googlesearchc)
    
    Join us on X (Twitter)

*   ### Get support
    
    *   [Go to the help forum](https://support.google.com/webmasters/community)
        
    *   [Submit a question for office hours](https://developers.google.com/search/help/office-hours)
        
    *   [Report spam, phishing, or malware](https://developers.google.com/search/help/report-quality-issues)
        
    *   [More support resources](https://developers.google.com/search/help)
        
*   ### Resources
    
    *   [Do you need an SEO?](https://developers.google.com/search/docs/fundamentals/get-on-google)
        
    *   [SEO Starter Guide](https://developers.google.com/search/docs/fundamentals/seo-starter-guide)
        
    *   [Status of Search systems](https://status.search.google.com/)
        
    *   [Search Console documentation](https://support.google.com/webmasters)
        
    *   [Case Studies](https://developers.google.com/search/case-studies)
        
*   ### Tools
    
    *   [Search Console](https://search.google.com/search-console)
        
    *   [Rich Results Test](https://search.google.com/test/rich-results)
        
    *   [PageSpeed Insights](https://pagespeed.web.dev/)
        
    *   [AMP Test](https://search.google.com/test/amp)
        

[![Google Developers](https://www.gstatic.com/devrel-devsite/prod/vb08cbdb02acf7f66ad9727ddfba9d81df8806422eb5dd63dba194c9c8c7997f7/developers/images/lockup-google-for-developers.svg)](https://developers.google.com/)

*   [Android](https://developer.android.com/)
    
*   [Chrome](https://developer.chrome.com/home)
    
*   [Firebase](https://firebase.google.com/)
    
*   [Google Cloud Platform](https://cloud.google.com/)
    
*   [Google AI](https://ai.google.dev/)
    
*   [All products](https://developers.google.com/products)
    

*   [Terms](https://developers.google.com/terms/site-terms)
    
*   [Privacy](https://policies.google.com/privacy)
    
*   [Manage cookies](https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics#)
    

*   English
*   Deutsch
*   Español
*   Español – América Latina
*   Français
*   Indonesia
*   Italiano
*   Polski
*   Português – Brasil
*   Tiếng Việt
*   Türkçe
*   Русский
*   العربيّة
*   हिंदी
*   ภาษาไทย
*   中文 – 简体
*   中文 – 繁體
*   日本語
*   한국어