Skip to content

Blog Post Example

iRaziul edited this page Mar 22, 2026 · 1 revision

Blog Post Example

use Larament\SeoKit\Facades\SeoKit;

public function show(Post $post)
{
    SeoKit::title($post->title)
        ->description($post->excerpt)
        ->image($post->featured_image)
        ->canonical(route('posts.show', $post));

    SeoKit::opengraph()->article(
        publishedTime: $post->published_at?->toIso8601String(),
        modifiedTime: $post->updated_at?->toIso8601String(),
        authors: [$post->author->profile_url],
        section: $post->category->name,
        tags: $post->tags->pluck('name')->all()
    );

    SeoKit::twitter()->card('summary_large_image');

    SeoKit::jsonld()->article([
        'headline' => $post->title,
        'description' => $post->excerpt,
        'image' => $post->featured_image,
    ]);

    return view('posts.show', compact('post'));
}

Clone this wiki locally