How do I add canonical URLs?
Last checked 31 Aug 2026
Short answer
Ask Lovable to add a <link rel="canonical"> tag to each page pointing to its preferred URL — this tells search engines which version to index when the same content is reachable at more than one address.
Why canonical tags matter
If the same content is reachable at more than one URL — https://yourdomain.com/pricing and https://yourdomain.com/pricing/, or with and without tracking parameters — search engines may treat them as duplicate content and dilute ranking signals across both. A canonical tag tells them which URL is the "real" one to index.
How to add one
Add a canonical link tag to each page's head pointing to its own clean URL, e.g. https://yourdomain.com/pricing without trailing slashes or query parameters.
Markup looks like:
<link rel="canonical" href="https://yourdomain.com/pricing" />
On a multi-route app, this needs to be set per page (each page's canonical points to itself, generally), not one static tag shared across the whole site.
Common situations that need canonicals
- Content reachable both with and without
www. - URLs with tracking parameters (
?utm_source=...) that are functionally the same page. - A product or listing page reachable via more than one category path.
What usually goes wrong
- A single hardcoded canonical URL copy-pasted onto every page (usually the homepage's) — this tells Google every page is actually the homepage, which is worse than having no canonical tags at all. Each page's canonical should point to itself unless you're deliberately consolidating duplicate content.
- Canonical pointing to
http://when the site is served overhttps://. - Forgetting canonicals entirely when running the same content on both a custom domain and the
lovable.appsubdomain — pick one as canonical to avoid duplicate-content dilution.
Related
Sources
Was this answer helpful?
Related questions
- AnswerHow do I connect Google Search Console?Use Lovable's Google Search Console integration to verify your domain and manage search data directly from chat, or verify manually by adding the DNS/HTML verification record Google provides.
- AnswerHow do I SEO a Lovable website?Set unique titles and meta descriptions per page, add a sitemap.xml and robots.txt, use Open Graph tags, add alt text to images, connect a custom domain, and submit your sitemap to Google Search Console.
- AnswerHow do I improve Lovable SEO?Use Lovable's built-in SEO & AI search review to fix titles, meta tags, sitemap and structured data, connect a custom domain, and keep writing real unique content on each page.
- AnswerDoes Lovable automatically create a sitemap?No — a sitemap.xml isn't generated automatically for a typical project. You need to ask Lovable to add one, or it may be included as part of a dedicated SEO setup/review feature on newer projects.
You might also need
- GuideHow to Set Up SEO for a Lovable ProjectTitles, descriptions, canonical URLs, Open Graph and structured data — the technical SEO baseline every project needs.
- GuideHow to Generate a Dynamic SitemapServe an XML sitemap that updates itself as you publish new content, instead of a static file that goes stale.