{"id":16570,"date":"2026-09-02T11:36:55","date_gmt":"2026-09-02T08:36:55","guid":{"rendered":"https:\/\/alienroad.com\/google-bilgi-bankasi\/javascript-seo-basics\/"},"modified":"2026-09-06T00:51:57","modified_gmt":"2026-09-05T21:51:57","slug":"javascript-seo-basics","status":"publish","type":"ar_kb","link":"https:\/\/alienroad.com\/google-bilgi-bankasi\/javascript-seo-basics\/","title":{"rendered":"Understand the JavaScript SEO basics"},"content":{"rendered":"<aside class=\"key-point\">\n  Do you suspect that JavaScript issues might be blocking your page or some of your content from showing up in Google Search?<br \/>\n  Learn how to fix JavaScript-related problems with our <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/fix-javascript-problems\/\">troubleshooting guide<\/a>.<br \/>\n<\/aside>\n<p>\n  JavaScript is an important part of the web platform because it provides many features that turn the web into a powerful application platform.<br \/>\n  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.<br \/>\n  While Google Search runs JavaScript with an <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/the-new-evergreen-googlebot\/\">evergreen version of Chromium<\/a>, there are <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/fix-javascript-problems\/\">a few things that you can optimize<\/a>.\n<\/p>\n<p>This guide describes how Google Search processes JavaScript and best practices for improving JavaScript web apps for Google Search.<\/p>\n<div class=\"video-wrapper-full-width\"><\/div>\n<h2 id=\"how-googlebot-processes-javascript\" tabindex=\"-1\">How Google processes JavaScript<\/h2>\n<p>Google processes JavaScript web apps in three main phases:<\/p>\n<ol>\n<li>Crawling<\/li>\n<li>Rendering<\/li>\n<li>Indexing<\/li>\n<\/ol>\n<p>\n  <img decoding=\"async\" src=\"https:\/\/alienroad.com\/wp-content\/uploads\/kb-gorsel\/g-26d9ecb91dd5.png\" loading=\"lazy\" alt=\"Googlebot takes a URL from the crawl queue,\n    crawls it, then passes it into the processing stage. The processing stage extracts links that\n    go back on the crawl queue and queues the page for rendering. The page goes from the render\n    queue to the renderer which passes the rendered HTML back to processing which indexes the content\n    and extracts links to put them into the crawl queue.\" \/>\n<\/p>\n<p>\n  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.<br \/>\n  When Googlebot fetches a URL from the crawling queue by making an HTTP request, it first checks if you allow crawling. Googlebot reads the <a href=\"https:\/\/developers.google.com\/search\/reference\/robots_txt\">robots.txt<\/a> file.<br \/>\n  If it marks the URL as disallowed, then Googlebot skips making an HTTP request to this URL and skips the URL. Google Search won&#8217;t render JavaScript from blocked files or on blocked pages.\n<\/p>\n<p>\n  Googlebot then parses the response for other URLs in the <code>href<\/code> attribute of HTML links and adds the URLs to the crawl queue. To prevent link discovery, use the <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/rel-attributes\/\"><code>nofollow<\/code> mechanism<\/a>.\n<\/p>\n<aside class=\"note\">\n  It&#8217;s fine to use JavaScript to inject links into the DOM, as long as such links follow the <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/internal-links\/#crawlable-links\">best practices for crawlable links<\/a>.<br \/>\n<\/aside>\n<p>\n  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.<br \/>\n  Some JavaScript sites may use the <a href=\"https:\/\/developers.google.com\/web\/fundamentals\/architecture\/app-shell\" class=\"external-link\">app shell model<\/a> 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.\n<\/p>\n<p>\n  Googlebot queues all pages with a <code>200<\/code> HTTP status code for rendering, unless a <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/robots-meta-tag\/\"><span>robots<\/span> <code>meta<\/code> tag or header<\/a> tells Google not to index the page.<br \/>\n  The page may stay on this queue for a few seconds, but it can take longer than that. Once Google&#8217;s resources allow, a headless Chromium renders the page and executes the JavaScript.<br \/>\n  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.\n<\/p>\n<aside class=\"note\">\n  All pages with a <code>200<\/code> HTTP status code are sent to the rendering queue, no matter whether JavaScript is present on the page.<br \/>\n  If the HTTP status code is non-<code>200<\/code> (for example, on error pages with <code>404<\/code> status code), rendering might be skipped.<br \/>\n<\/aside>\n<p>\n  Keep in mind that <a href=\"https:\/\/developers.google.com\/web\/updates\/2019\/02\/rendering-on-the-web\" class=\"external-link\">server-side or pre-rendering<\/a> is still a great idea because it makes your website faster for users and crawlers, and not all bots can run JavaScript.\n<\/p>\n<h2 id=\"titles-and-snippets\" tabindex=\"-1\">Describe your page with unique titles and snippets<\/h2>\n<p>\n  Unique, descriptive <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/title-links\/#page-titles\"><code>&lt;title&gt;<\/code> elements<\/a> and <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/snippets\/#meta-descriptions\">meta descriptions<\/a> help users quickly identify the best result for their goal.<br \/>\n  You can use JavaScript to set or change the meta description as well as the <code>&lt;title&gt;<\/code> element.\n<\/p>\n<h2 id=\"canonical-links\" tabindex=\"-1\">Set the canonical URL<\/h2>\n<p>\n  The <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/specify-canonical\/#rel-canonical-link-method\"><code>rel=\"canonical\"<\/code> link tag<\/a> helps Google find the canonical version of a page.<br \/>\n  You can use JavaScript to set the canonical URL, but keep in mind that you shouldn&#8217;t use JavaScript to change the canonical URL to something else than the URL you specified as the canonical URL in the original HTML.<br \/>\n  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.<br \/>\n  If you can&#8217;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.\n<\/p>\n<h2 id=\"write-compatible-code\" tabindex=\"-1\">Write compatible code<\/h2>\n<p>\n  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<br \/>\n  compatible with Google, follow our <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/fix-javascript-problems\/\">guidelines for troubleshooting JavaScript problems<\/a>.\n<\/p>\n<p>\n  We recommend <a href=\"https:\/\/web.dev\/articles\/codelab-serve-modern-code\" class=\"external-link\">using differential serving and polyfills<\/a> if you feature-detect a missing browser API that you need.<br \/>\n  Since some browser features cannot be polyfilled, we recommend that you check the polyfill documentation for potential limitations.\n<\/p>\n<h2 id=\"use-meaningful-http-status-codes\" tabindex=\"-1\">Use meaningful HTTP status codes<\/h2>\n<p>\n  Googlebot uses <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/how-http-status-codes-affect-googles-crawlers\/\">HTTP status codes<\/a> to find out if something went wrong when crawling the page.\n<\/p>\n<p>\n  To tell Googlebot if a page can&#8217;t be crawled or indexed, use a meaningful status code, like a <code>404<\/code> for a page that could not be found or a <code>401<\/code> code for pages behind a login.<br \/>\n  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.\n<\/p>\n<p>Here&#8217;s a <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/how-http-status-codes-affect-googles-crawlers\/#http-status-codes\">list of HTTP status codes<\/a> and how they effect Google Search.<\/p>\n<h3 id=\"avoid-soft-404s\" tabindex=\"-1\">Avoid <code>soft 404<\/code> errors in single-page apps<\/h3>\n<p>\n  In client-side rendered single-page apps, routing is often implemented as client-side routing.<br \/>\n  In this case, using meaningful HTTP status codes can be impossible or impractical.<br \/>\n  To avoid <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/troubleshoot-google-search-crawling-errors\/#soft-404-errors\"><code>soft 404<\/code> errors<\/a> when using client-side rendering and routing, use one of the following strategies:\n<\/p>\n<ul>\n<li>Use a <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/redirects-and-google\/#jslocation\">JavaScript redirect<\/a> to a URL for which the server responds with a <code>404<\/code> HTTP status code (for example <code>\/not-found<\/code>).<\/li>\n<li>Add a <code>&lt;meta name=\"robots\" content=\"noindex\"&gt;<\/code> to error pages using JavaScript.<\/li>\n<\/ul>\n<p>Here is sample code for the redirect approach:<\/p>\n<div><\/div>\n<p>Here is sample code for the <code>noindex<\/code> tag approach:<\/p>\n<div><\/div>\n<h2 id=\"use-history-api\" tabindex=\"-1\">Use the History API instead of fragments<\/h2>\n<p>\n  Google can only discover your links if they are <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/internal-links\/\"><code>&lt;a&gt;<\/code> HTML elements with an <code>href<\/code> attribute<\/a>.\n<\/p>\n<p>\n  For single-page applications with client-side routing, use the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/History\" class=\"external-link\">History API<\/a> to implement routing between different views of your web app.<br \/>\n  To ensure that Googlebot can parse and extract your URLs, don&#8217;t use fragments to load different page content.<br \/>\n  The following example is a bad practice, because Googlebot can&#8217;t reliably resolve the URLs:\n<\/p>\n<div><\/div>\n<p>Instead, you can make sure your URLs are accessible to Googlebot by implementing the History API:<\/p>\n<div><\/div>\n<h2 id=\"properly-inject-canonical-links\" data-text='Properly inject the rel=\"canonical\" link tag' tabindex=\"-1\">Properly inject the <code>rel=\"canonical\"<\/code> link tag<\/h2>\n<p>\n  While we don&#8217;t recommend using JavaScript for this, it is possible to inject a <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/specify-canonical\/#rel-canonical-link-method\"><code>rel=\"canonical\"<\/code> link tag<\/a> with JavaScript.<br \/>\n  Google Search will pick up the injected canonical URL when rendering the page. Here is an example to inject a <code>rel=\"canonical\"<\/code> link tag with JavaScript:\n<\/p>\n<div><\/div>\n<aside class=\"warning\">\n  When using JavaScript to inject the <code>rel=\"canonical\"<\/code> link tag, make sure that this is the only <code>rel=\"canonical\"<\/code> link tag on the page.<br \/>\n  Incorrect implementations might create multiple <code>rel=\"canonical\"<\/code> link tag or change an existing <code>rel=\"canonical\"<\/code> link tag.<br \/>\n  Conflicting or multiple <code>rel=\"canonical\"<\/code> link tags may lead to unexpected results.<br \/>\n<\/aside>\n<h2 id=\"use-meta-robots-tags-carefully\" tabindex=\"-1\">Use <span>robots<\/span> <code>meta<\/code> tags carefully<\/h2>\n<p>\n  You can prevent Google from indexing a page or following links through the <span>robots<\/span> <code>meta<\/code> tag.<br \/>\n  For example, adding the following <code>meta<\/code> tag to the top of your page blocks Google from indexing the page:\n<\/p>\n<div><\/div>\n<p>\n  You can use JavaScript to add a <span>robots<\/span> <code>meta<\/code> tag to a page or change its content.<br \/>\n  The following example code shows how to change the <span>robots<\/span> <code>meta<\/code> tag with JavaScript to prevent indexing of the current page if an API call doesn&#8217;t return content.\n<\/p>\n<div><\/div>\n<aside class=\"warning\">\n  When Google encounters the <code>noindex<\/code> tag, it may skip rendering and JavaScript<br \/>\n  execution, which means using JavaScript to change or remove the <span>robots<\/span><br \/>\n  <code>meta<\/code> tag from <code>noindex<\/code> may not work as expected. If you <i>do<\/i> want the page indexed, don&#8217;t use a<br \/>\n  <code>noindex<\/code> tag in the original page code.<br \/>\n<\/aside>\n<h2 id=\"caching\" tabindex=\"-1\">Use long-lived caching<\/h2>\n<p>\n  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.<br \/>\n  Content fingerprinting avoids this problem by making a fingerprint of the content part of the filename, like <code>main.2bb85551.js<\/code>.<br \/>\n  The fingerprint depends on the content of the file, so updates generate a different filename every time.<br \/>\n  Check out the <a href=\"https:\/\/web.dev\/articles\/http-cache#versioned-urls\" class=\"external-link\">web.dev guide on long-lived caching strategies<\/a> to learn more.\n<\/p>\n<h2 id=\"structured-data\" tabindex=\"-1\">Use structured data<\/h2>\n<p>\n  When using <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/structured-data-intro\/\">structured data<\/a> on your pages, you can use <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/generate-structured-data-with-javascript\/#testing\">JavaScript to generate the required JSON-LD and inject it into the page<\/a>. Make sure to <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/debugging-your-pages\/\">test your implementation<\/a> to avoid issues.\n<\/p>\n<h2 id=\"web-components\" tabindex=\"-1\">Follow best practices for web components<\/h2>\n<p>\n  Google supports web components.<br \/>\n  When Google renders a page, it <a href=\"https:\/\/developers.google.com\/web\/fundamentals\/web-components\/shadowdom#lightdom\" class=\"external-link\">flattens the shadow DOM and light DOM<\/a> content.<br \/>\n  This means Google can only see content that&#8217;s visible in the rendered HTML. To make sure that Google can still see your content after it&#8217;s rendered, use the <a href=\"https:\/\/search.google.com\/test\/rich-results\" class=\"external-link\">Rich Results Test<\/a> or the <a href=\"https:\/\/support.google.com\/webmasters\/answer\/9012289\" class=\"external-link\">URL Inspection Tool<\/a> and look at the rendered HTML.\n<\/p>\n<p>\n  If the content isn&#8217;t visible in the rendered HTML, Google won&#8217;t be able to index it.\n<\/p>\n<p>\n  The following example creates a web component that displays its light DOM content inside its shadow DOM.<br \/>\n  One way to make sure both light DOM and shadow DOM content is displayed in the rendered HTML is to use a <a href=\"https:\/\/developers.google.com\/web\/fundamentals\/web-components\/shadowdom#slots\" class=\"external-link\">Slot<\/a> element.\n<\/p>\n<div><\/div>\n<p>After rendering, Google can index this content:<\/p>\n<div><\/div>\n<h2 id=\"fix-images\" tabindex=\"-1\">Fix images and lazy-loaded content<\/h2>\n<p>\n  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.<br \/>\n  To make sure you&#8217;re implementing lazy-loading in a search-friendly way, follow <a href=\"https:\/\/alienroad.com\/google-bilgi-bankasi\/fix-lazy-loaded-content\/\">our lazy-loading guidelines<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Discover how Google Search processes JavaScript and explore best practices for improving JavaScript web apps for Google Search.<\/p>\n","protected":false},"menu_order":37,"template":"","meta":{"footnotes":""},"ar_kb_kategori":[690],"ar_kb_etiket":[530,572,573],"class_list":["post-16570","ar_kb","type-ar_kb","status-publish","has-post-thumbnail","hentry","ar_kb_kategori-javascript","ar_kb_etiket-indexing","ar_kb_etiket-javascript","ar_kb_etiket-rendering"],"_links":{"self":[{"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/ar_kb\/16570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/ar_kb"}],"about":[{"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/types\/ar_kb"}],"version-history":[{"count":2,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/ar_kb\/16570\/revisions"}],"predecessor-version":[{"id":25561,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/ar_kb\/16570\/revisions\/25561"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/media\/26333"}],"wp:attachment":[{"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/media?parent=16570"}],"wp:term":[{"taxonomy":"ar_kb_kategori","embeddable":true,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/ar_kb_kategori?post=16570"},{"taxonomy":"ar_kb_etiket","embeddable":true,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/ar_kb_etiket?post=16570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}