---
description: Google's JavaScript documentation says to set canonical URLs in HTML when possible. If you use JavaScript, it must match the canonical in the original HTML.
title: Google updates JavaScript canonical guidance
image: https://cdn.prod.website-files.com/6b00ac6e3b04f0fd00321496/6b04b9e7ec4e74c97938bfb9_og-industry-news.png
canonical_url: https://momenticmarketing.com/seo-news/1765985480-619709
last_updated: 2025-12-17T15:31:20.000Z
---

> Index of this website for AI agents: [/llms.txt](/llms.txt)

[Skip to main content](#main)

![](https://cdn.prod.website-files.com/6b00bc449c8cb14f592e05e8/6b00cb9d0aed3a2cc993c554_687fc941959da183b98dbe65_7814883997076_27f4d0c79d08cf42287d_72.jpeg)

Tamara

December 17, 2025

# Google clarifies canonical URL best practices for JavaScript

Google updated [some more JS documentation (opens in a new tab)](https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics#canonical-links), this time to clarify canonicalization best practices for JavaScript:

> 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.

Our lesson on [how to index your website](/content-academy/indexation) explains how to get a page into Google's and Bing's index and check that AI crawlers receive it, and our [technical SEO service](/technical-seo) audits and fixes crawling, rendering, indexing and structured data.

## More notes

[All industry news](/industry-news)

Tamara

December 15, 2025

Google updated its JavaScript docs on noindex, saying rendering behavior is not well defined. Skip noindex in original code if you might want indexing.

[Permalink](/seo-news/1765818471-532969)

Tamara

December 15, 2025

Ahrefs analyzed 75K brands across ChatGPT, AIO, and AI Mode. YouTube mentions correlated most with AI mentions, while website page count showed almost no link.

[Permalink](/seo-news/1765814370-658649)

Tamara

December 12, 2025

Google is testing Disco, an experiment that uses open tabs and chat history to help people browse and build no-code tools. A waitlist is open for GenTabs.

[Permalink](/seo-news/1765551619-843949)

![](https://cdn.prod.website-files.com/6b00ac6e3b04f0fd00321496/6b00b7e2cb70ab46675d0bfd_momo-momentic-mascot.webp)

## Tell us what you need help with.

[Talk to us](/contact)

```json
{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "Organization",
      "@id": "https://momenticmarketing.com/#organization",
      "name": "Momentic",
      "legalName": "Momentic LLC",
      "alternateName": [
        "Momentic LLC",
        "Momentic®",
        "Momentic™"
      ],
      "url": "https://momenticmarketing.com/",
      "logo": {
        "@type": "ImageObject",
        "url": "https://cdn.prod.website-files.com/6b00ac6e3b04f0fd00321496/6b00b7e274cd0b435ba8b505_momentic-logo.svg"
      },
      "sameAs": [
        "https://www.linkedin.com/company/momentic-seo",
        "https://www.facebook.com/MomenticSEO/",
        "https://twitter.com/MomenticSEO",
        "https://www.instagram.com/momenticseo/",
        "https://www.crunchbase.com/organization/momentic-677e",
        "https://clutch.co/profile/momentic"
      ]
    },
    {
      "@type": "WebSite",
      "@id": "https://momenticmarketing.com/#website",
      "name": "Momentic",
      "url": "https://momenticmarketing.com/",
      "publisher": {
        "@id": "https://momenticmarketing.com/#organization"
      }
    }
  ]
}
{"@context":"https://schema.org","@graph":[{"@type":"WebPage","@id":"https://momenticmarketing.com/seo-news/1765985480-619709#webpage","url":"https://momenticmarketing.com/seo-news/1765985480-619709","name":"Google updates JavaScript canonical guidance","description":"Google\u0027s JavaScript documentation says to set canonical URLs in HTML when possible. If you use JavaScript, it must match the canonical in the original HTML.","inLanguage":"en-US","isPartOf":{"@id":"https://momenticmarketing.com/#website"},"breadcrumb":{"@id":"https://momenticmarketing.com/seo-news/1765985480-619709#breadcrumb"},"mainEntity":{"@id":"https://momenticmarketing.com/seo-news/1765985480-619709#article"},"primaryImageOfPage":{"@id":"https://momenticmarketing.com/seo-news/1765985480-619709#image"},"datePublished":"2025-12-17T15:31:20Z"},{"@type":"NewsArticle","@id":"https://momenticmarketing.com/seo-news/1765985480-619709#article","headline":"Google updates JavaScript canonical guidance","description":"Google\u0027s JavaScript documentation says to set canonical URLs in HTML when possible. If you use JavaScript, it must match the canonical in the original HTML.","url":"https://momenticmarketing.com/seo-news/1765985480-619709","datePublished":"2025-12-17T15:31:20Z","dateModified":"2025-12-17T15:31:20Z","author":{"@id":"https://momenticmarketing.com/team/tamara-hellgren#person"},"publisher":{"@id":"https://momenticmarketing.com/#organization"},"mainEntityOfPage":{"@id":"https://momenticmarketing.com/seo-news/1765985480-619709#webpage"},"isPartOf":{"@id":"https://momenticmarketing.com/industry-news#webpage"},"inLanguage":"en-US","image":{"@type":"ImageObject","@id":"https://momenticmarketing.com/seo-news/1765985480-619709#image","url":"https://cdn.prod.website-files.com/6b00ac6e3b04f0fd00321496/6b04b9e7ec4e74c97938bfb9_og-industry-news.png"}},{"@type":"BreadcrumbList","@id":"https://momenticmarketing.com/seo-news/1765985480-619709#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://momenticmarketing.com/"},{"@type":"ListItem","position":2,"name":"Industry news","item":"https://momenticmarketing.com/industry-news"},{"@type":"ListItem","position":3,"name":"Google updates JavaScript canonical guidance","item":"https://momenticmarketing.com/seo-news/1765985480-619709"}]}]}
```
