Setup for VILT stack (Can be used for TALL stack too)

All default SEO metatags are located in resources/views/seo/metatags.blade.php file.

In resources/views/app.blade.php file you can find
@include('seo.metatags', ['seo' => $page['props']['seo'] ?? null]) which includes the metatags file into the layout file.

If you want to add SEO metatags to a specific page, you should add seo key to the page’s data array and pass the metatags array to it.

Example on BlogController.php:

BlogController.php
<?php

...
class BlogController extends Controller
{
   ...
    public function article(Article $article): \Inertia\Response
    {
        ...
        return Inertia::render('Article', [
            'article' => $article->load('user'),
            'seo' => [
                'title' => $article->seo_title ?? $article->title,
                'description' => $article->seo_description ?? Str::limit($article->content, 160),
                'canonical' => route('blog.article', ['article' => $article]),
            ],
        ]);
    }
}

If you bought Larafast VILT stack before May 5, 2024, you can do following to update the SEO setup:

  1. Remove all meta tags from resources/views/app.blade.php file.
  2. Add the following code inside the <head> component in resources/views/app.blade.php file: @include('seo.metatags', ['seo' => $page['props']['seo'] ?? null])
  3. Remove <Head title="..."> ... from resources/js/Layouts/HomeLayout.vue file.
  4. Remove <Seo title="..." description="..."> ... from resources/js/Pages/Article.vue and resources/js/Pages/Blog.vue file and from everywhere you have added.
  5. Follow the documentation above to add SEO metatags to your pages.

Use `resources/js/Components/Seo.vue wrapper component to add SEO tags in your pages.

Or, alternatively use Inertia’s <Head> component, which adds meta tags to the <head>.

<Seo title="Larafast" description="Ship Your SaaS Faster with Larafast">
    <!-- Twitter Card Tags -->
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content="Ship Faster with Larafast - Laravel Starter Kit">
    <meta name="twitter:description" content="Boost your startup with Larafast - Laravel Starter Kit - a powerful solution for efficiency, speed, and success in your entrepreneurial journey. Transform your idea into reality in just a matter of days.">
    <!-- Add your Twitter handle below -->
    <meta name="twitter:site" content="@yourTwitterHandle">
    <meta name="twitter:image" content="/images/hero.jpeg">
</Seo>

Defaults

Default SEO meta tags are located in `resources/js/Layouts/HomeLayout.vue the component.

To overwrite them, use the example from above to pass new values to your new pages.

Blog and Articles

The blog page and Article page come with predefined SEO configurations and Schema.org markup.

To read more about the Inertia.js Head component check the official documentation: https://inertiajs.com/title-and-meta

For good SEO and Google Page indexing, it’s crucial to have Sitemap.