Closed bhulsman closed 6 years ago
I just realized that @yield('canonical', request()->url())
means you can do @section('canonical', $article->url)
from the article blade template. Which is how you guys solved it. 😎
Thanks for open sourcing Blender, there is a lot to learn here! 🛐
As I was curious how you guys were solving the canonical meta tag and if you were using canonical redirects.
I noticed you guys use
request()->url()
as the canonical URL (https://github.com/spatie/blender/blob/master/resources/views/front/layouts/partials/head/meta.blade.php). Besides that also the last slug of an article is used to find the article in the database (https://github.com/spatie/blender/blob/master/app/Http/Controllers/Front/ArticleController.php). So if the parent of the article changes, then you'd have the following./old-parent/lorem-ipsum /new-parent/lorem-ipsum
When visiting those urls, the canonical would be the requested URL, instead of /new-parent/lorem-ipsum. Shouldn't the canonical URL be
$article->url
instead ofrequest()->url()
?If I'm wrong or just clueless; feel free to close the issue 😉