SEO
SEO setup in Larafast
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
:
If you bought Larafast VILT stack before May 5, 2024, you can do following to update the SEO setup:
- Remove all meta tags from
resources/views/app.blade.php
file. - Add the following code inside the
<head>
component inresources/views/app.blade.php
file:@include('seo.metatags', ['seo' => $page['props']['seo'] ?? null])
- Remove
<Head title="..."> ...
fromresources/js/Layouts/HomeLayout.vue
file. - Remove
<Seo title="..." description="..."> ...
fromresources/js/Pages/Article.vue
andresources/js/Pages/Blog.vue
file and from everywhere you have added. - Follow the documentation above to add SEO metatags to your pages.
Setup for VILT stack [old, not recommended as the dynamic og images are not working properly]
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>
.
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.