Keep it canonical for SEO

Use canonical URLs to keep search engines straight on which content they should index.


When you deploy your static website to a typical Jamstack-savvy hosting vendor, your host generates the site within a subdomain for one of that host’s top-level domains (which may be something ending in .app or .dev). This continues to exist as a “live” website even if you’ve assigned a custom domain to your site, as I have assigned the domain to this site.

With some hosts — notably, Netlify and the DigitalOcean App Platform — the subdomain may be some randomly generated nonsense, resulting in a URL of, say, (although you usually can edit this subdomain to be something less, um, weird). Other hosts may use the name of your originating Git project, as do Cloudflare Pages and Vercel.

For example, let’s say you have a site on Cloudflare Pages and have assigned the domain to the site. If the project’s online repo is called our-website-repo, it would exist on the web as not only but also something like This presents you with a potential problem for your site’s search engine optimization (SEO): you must ensure that, when Google and other search engines find your content, they’ll “know” which one — your “real” site at or the version — to feature in their respective indices. Otherwise, the SEO “search juice” might go to that other version and not to the desired location at

The good thing is, it’s simple to avoid this problem: just provide a canonical URL. This indication, which takes the form of a canonical tag in your HTML’s head element, tells search engines which online instance of each page to index.

If you’re building your site with a static site generator (SSG) or other method that creates pages through templating, this is fairly simple to do. In a more manually built site, you may have a lot of pages to edit.

Anyway, continuing with our example (?), here are links to explain how to do this in my three favorite SSGs:

Take these simple steps to maximize the likelihood that the content of your real site, and not that of the site’s oddly named twin out on the host’s platform, will garner all the “search juice” it deserves.