1
0
Fork 0
mirror of https://github.com/archtechx/laravel-seo.git synced 2025-12-12 01:44:03 +00:00

Canonical URLs, fix #1

This commit is contained in:
Samuel Štancl 2021-05-26 13:18:13 +02:00
parent 6df030c28d
commit db7269ff28
4 changed files with 67 additions and 10 deletions

View file

@ -48,6 +48,7 @@ Use the `seo()` helper to retrieve the SeoManager instance, on which you can cal
Available methods:
```js
site(string $site)
url(string $url)
title(string $title)
description(string $description)
image(string $url)
@ -108,6 +109,31 @@ seo()
->description(default: 'We are a web development agency that ...');
```
### Extra tags
To add more tags to the head, you can use the `tag()` and `rawTag()` methods:
```php
seo()->tag('fb:image', asset('foo'));
seo()->rawTag('<meta property="fb:url" content="bar" />');
```
### Canonical URL
To enable the `og:url` and canonical URL `link` tags, call:
```php
seo()->withUrl();
```
This will make the package read from `request()->url()` (= the current URL *without* the query string).
If you wish to change the URL, call `seo()->url()`:
```php
seo()->url(route('products.show', $this->product));
```
### Modifiers
You may want to modify certain values before they get inserted into the template. For example, you may want to suffix the meta `<title>` with `| ArchTech` when it has a non-default value.
@ -226,15 +252,6 @@ This package is completely flexible, and can be customized either by having its
You can publish the Blade views by running `php artisan vendor:publish --tag=seo-views`.
### Extra tags
To add more tags to the head, you can use the `tag()` and `rawTag()` methods:
```php
seo()->tag('fb:image', asset('foo'));
seo()->rawTag('<meta property="fb:url" content="bar" />');
```
### Extensions
To use a custom extension, create a Blade *component* with the desired meta tags. The component should read data using `{{ seo()->get('foo') }}` or `@seo('foo')`.