Open
Description
In the link Inertia SEO is implemented but i cant get it working or do not understand how.
Static home.vue
<template>
<div class="blocks">
<Head>
<title>Home</title>
<meta name="description" content="The homepage" />
</Head>
<h1>Home</h1>
<hr />
<Link :href="route('templates.home')">Home</Link>
<Link :href="route('templates.product')">Product</Link>
</div>
</template>
<script setup>
import { Link } from '@inertiajs/vue3';
import { Head } from '@inertiajs/vue3';
</script>
The title and description are printed. Switching to /product changes according to my product.vue
When trying to make dynamic
config/seotools.php
'inertia' => true,
routes/templates.php
<?php
use Artesaos\SEOTools\Facades\JsonLd;
use Artesaos\SEOTools\Facades\OpenGraph;
use Artesaos\SEOTools\Facades\SEOMeta;
use Artesaos\SEOTools\Facades\SEOTools;
use Artesaos\SEOTools\Facades\TwitterCard;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
Route::get('/', function () {
SEOMeta::setTitle('home dynamic');
SEOMeta::setDescription('home dynamic description');
$seo = SEOTools::generate();
return Inertia::render('templates/Home', ['seo' => $seo]);
})->name('home');
Route::get('/product', function () {
SEOMeta::setTitle('product dynamic');
SEOMeta::setDescription('product dynamic description');
$seo = SEOTools::generate();
return Inertia::render('templates/Product', ['seo' => $seo]);
})->name('product');
home.vue
<template>
<div class="blocks">
<Head>
{{ seo }}
</Head>
<h1>Home</h1>
<hr />
<Link :href="route('templates.home')">Home</Link>
<Link :href="route('templates.product')">Product</Link>
</div>
</template>
<script setup>
import { Link } from '@inertiajs/vue3';
import { Head } from '@inertiajs/vue3';
const props = defineProps({
seo: {
type: Object,
},
});
</script>
Looking at home, the title is applied, the description is not printed
When i remove title (only appending description)
When switching between /home and /product it goes dynamic, but only 1 seo item is printed.
Its weird because when i generate the title + description and log using
{{ seo }}both are there
Metadata
Metadata
Assignees
Labels
No labels