Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Canonical and request()->url() #516

Closed
bhulsman opened this issue Apr 24, 2018 · 1 comment
Closed

Canonical and request()->url() #516

bhulsman opened this issue Apr 24, 2018 · 1 comment

Comments

@bhulsman
Copy link

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 of request()->url()?

If I'm wrong or just clueless; feel free to close the issue 😉

@bhulsman
Copy link
Author

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! 🛐

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant