Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Donika's avatar

Meta Tags

Hello, i google this question, but i found the answer in video where i must pay for one month to wath video where explain how to create meta tags. So, maybe some one explain me, or give some url for topic, where i can see how to add to description, title and keywords.... and other features...

0 likes
10 replies
Donika's avatar

No :) I mean how to display for example Post page, and in controller have some function smth like this"TAG:set_title($post->title);"

christopher's avatar

Just create your form which creates your posts?

And in your post view you can output your values from the database like { { $post->meta_description } }

christopher's avatar
Level 30

@Donika For example. Its up to you how you gonna make it. For example: My post view looks like this:

@extends('app')

@section('title'){!! $tutorial->title !!} @stop
@section('og-title'){!! $tutorial->title !!} @stop

@section('meta-description'){!! $tutorial->meta_description !!}  @stop 

@section('content')
...
...
...

And my header.blade.php looks like this

...
...
 <title>@yield('title', 'Shopware Agentur, Tutorials, Online Kurse & Hosting')</title>
 <meta property="og:title" content="@yield('og-title', 'Shopware Agentur, Tutorials, Online Kurse & Hosting.')" />
<meta name="description" content="@yield('meta-description', 'Shopware Agentur, Tutorials, Online Kurse & Hosting.')" />
....
1 like
royduin's avatar

@christopher, just a little improvement to your example, I think this is a little bit cleaner:

@section('title',$tutorial->title)
@section('og-title',$tutorial->title)
@section('meta-description',$tutorial->meta_description)
1 like
christopher's avatar

@royduin oh thanks. Never tried it to write like yours, but yes it is much cleaner. Will use it in the future :)

chicongst's avatar

You can use this:

html_entity_decode(strip_tags($content))

Please or to participate in this conversation.