🚀 Google SEO with Laravel: Sitemap, Schema and Meta Generator Guide

Entrance

In modern websites, SEO is no longer just about adding keywords.

Google actively uses sitemaps, structured data (schema), and meta tags to understand the structure of a page.

In this article, in a Laravel-based project:

Sitemap creation

Schema (JSON-LD) usage

Meta generator system

Google Search Console integration

I will explain topics like these in a technical and practical way.

📌 1. What is a Sitemap and Why is it Important?

A sitemap is an XML file that tells Google about the URLs on your website.

Example:

XML

<url>

<loc>https://ferhatgolge.com/blog/saas-platform</loc>

<lastmod>2026-03-15</lastmod>

</url>

Automatic sitemap in Laravel

In Laravel, generating dynamics using services is the most appropriate method:

PHP

Route::get('/sitemap.xml', function () {

$posts = Post::latest()->get();


return response()->view('sitemap', compact('posts'))

->header('Content-Type', 'application/xml');

});

🧠 2. What is Schema (Structured Data)?

Schema tells Google what the page is.

Example:

HTML

<script type="application/ld+json">

{

"@context": "https://schema.org",

"@type": "BlogPosting",

"headline": "Laravel SEO Guide"

}

</script>

Automatic schema in Laravel

PHP

class Schema

{

public static function blogPost($post)

{

return [

"@context" => "https://schema.org",

"@type" => "BlogPosting",

"headline" => $post->title,

"datePublished" => $post->created_at->toIso8601String(),

];

}

}

Blade:

Blade

<script type="application/ld+json">

{!! json_encode(\App\Helpers\Schema::blogPost($post)) !!}

</script>

🧩 3. Meta Generator System

Instead of writing metadata for each page, a centralized structure should be established.

Example SEO Helper

PHP

class SEO

{

public static function blogPost($post)

{

return [

'title' => $post->title . ' | Ferhat Gölge',

'description' => Str::limit(strip_tags($post->content), 160),

'image' => asset($post->cover_image),

'canonical' => url()->current(),

];

}

}

Usage within the layout

Blade

<title>{{ $seo['title'] }}</title>

<meta name="description" content="{{ $seo['description'] }}">

<link rel="canonical" href="{{ $seo['canonical'] }}">

🔍 4. Google Search Console Integration

To introduce your site to Google:

Log in to Search Console.

Add domain

Submit Sitemap


https://ferhatgolge.com/sitemap.xml

Verification (Meta Tag)

HTML

<meta name="google-site-verification" content="xxxx" />

In Laravel, you can make this dynamic.

❓ 5. Increasing CTR with FAQ Schema

Adding FAQs to blog posts increases CTR.

PHP

public static function faq($items)

{

return [

"@context" => "https://schema.org",

"@type" => "FAQPage",

"mainEntity" => $items

];

}

⚡ 6. The Most Important SEO Rules

This is a must-have for any Laravel project:

✔ Title is in the correct format

✔ Meta description is full

✔ Canonical available

✔ Sitemap is active

✔ Schema is being used

✔ OpenGraph is available

✔ Pages are linked to each other.

🎯 Result

Building an SEO-friendly system with Laravel isn't actually difficult.

What's important:

to create an automated system

resetting the manual error

Providing accurate data to Google.

When these three come together:

👉 faster indexing

👉 better ranking

👉 higher CTR

You will obtain it.

Comments

Log in or sign up to write a comment
Giriş
Sign Up