Closed Themesfa closed 6 years ago
What's the output you're getting ?
Or you want to do something like this ?
<h1>{{ seo_helper()->meta()->getTitle() }}</h1>
my codes :
UserController.php
public function show()
{
$this->seo()->setTitle('Users','Themesfa','‹');
return view( 'users' );
}
users.blade.php
<head>
{!! seo_helper()->render() !!}
</head>
<body>
...
...
<div class="page-header"><h1>"I want to print page title here"</h1></div>
</body>
the output in head is =>
There is a workaround for this:
UserController.php
public function show()
{
$this->seo()->setTitle($title = 'Users','Themesfa','‹');
return view('users', compact('title'));
}
users.blade.php
<head>
{{ seo_helper()->renderHtml() }}
</head>
<body>
...
...
<div class="page-header"><h1>{{ $title or 'Default title' }}</h1></div>
</body>
I'm going to think about this feature if doesn't exists 👍
it works, but Have any idea how to make it more beautiful? i think you must create a method and return all seo Variables . so users can access seo Variables in blade.
In my projects, i always extend my base controller to make things beautiful and organized, something like this:
Controller.php (using Arcanedev\SeoHelper\Traits\Seoable)
public function setTitle($title, $siteName = null, $separator = null)
{
view()->share('title', $title);
return parent::setTitle($title, $siteName, $separator);
}
UserController.php
public function show()
{
$this->setTitle('Users','Themesfa','‹');
return view('users');
}
users.blade.php
<head>
{{ seo_helper()->renderHtml() }}
</head>
<body>
...
...
<div class="page-header"><h1>{{ $title or 'Default title' }}</h1></div>
</body>
you right👍 . i'm new in laravel . forgive me thank you for your help.
PR: #38
Now you can access the title entity with: seo_helper()->meta()->getTitleEntity()->getTitleOnly()
hi . i want to get site title and use in other place on page layout . how i should get title string without meta html ?