Description
Never worry about SEO in Laravel again!
This package generates valid and useful meta tags straight out-of-the-box, with limited initial configuration, while still providing a simple, but powerful API to work with. It can generate:
- Title tag (with sitewide suffix)
- Meta tags (author, description, image, robots, etc.)
- OpenGraph Tags (Facebook, LinkedIn, etc.)
- Twitter Tags
- Structured data (Article, Breadcrumbs, FAQPage, or any custom schema)
- Favicon
- Robots tag
- Alternates links tag
If you're familiar with Spatie's media-library package, this package works in almost the same way, but then only for SEO. I'm sure it will be very helpful for you, as it's usually best for a website to have attention for SEO right from the beginning.
Here are a few examples of what you can do:
$post = Post::find(1); $post->seo->update([ 'title' => 'My great post', 'description' => 'This great post will enhance your live.',]);
It will render the SEO tags directly on your page:
<!DOCTYPE html><html><head> {!! seo()->for($post) !!} {{-- No need to separately render a <title> tag or any other meta tags! --}}</head>
It even allows you to dynamically retrieve SEO data from your model, without having to save it manually to the SEO model. The below code will require zero additional work from you or from your users:
class Post extends Model{ use HasSEO; public function getDynamicSEOData(): SEOData { $pathToFeaturedImageRelativeToPublicPath = // ..; // Override only the properties you want: return new SEOData( title: $this->title, description: $this->excerpt, image: $pathToFeaturedImageRelativeToPublicPath, ); }}