Aug 3, 2024
0
Level 9
Canonical URL for SEO in Laravel / Inertia+SSR / Vue
I'm trying to get a canonical url working in my Laravel 10 / Inertia 1 (with SSR) / Vue 3 app using the <Head> component from Inertia...
I've tried accessing both Inertia.initialPage.url and usePage().props.url both without success because the properties of Router are protected...
I've also tried route(route().current()) but then I run into the problem of routes that have route props vs ones that don't.
Is there a built-in way to retrieve a url that can be used for canonical purposes, or do I have to code that as an additional prop starting in Laravel?
Please or to participate in this conversation.