Canonical with useSeoMeta and useHead
A relative canonical resolves differently depending on the requested URL, which is exactly the ambiguity a canonical exists to remove. Check meta-canonical-absolute
<script setup lang="ts">
const route = useRoute();
const canonical = `https://www.example.com${route.path.replace(/\/$/, "")}`;
useSeoMeta({
title: "Pricing | Acme",
description: "Three tiers, one-time payment, 30 day refund.",
ogUrl: canonical,
twitterCard: "summary_large_image",
});
// useSeoMeta covers meta tags but not link elements, so the canonical
// itself goes through useHead.
useHead({ link: [{ rel: "canonical", href: canonical }] });
</script>