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 add schema markup?Ask Lovable to add JSON-LD structured data (schema.org markup) relevant to your page type — e.g. Organization, Product, Article or FAQ — inserted as a script tag in the page head.
- 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.
- AnswerHow do I stop a Lovable page being indexed?Ask Lovable to add a noindex meta tag to that specific page, and optionally disallow it in robots.txt — don't block the whole domain by mistake.
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.