artesaos / seotools

SEO Tools for Laravel
MIT License
3.07k stars 503 forks source link

SetTitle always append defaults #94

Closed iwasingh closed 7 years ago

iwasingh commented 7 years ago

Hi and thanks for the great work. I don't know why but whenever i set new title in my controller, for example with SEO::setTitle('test'); or SEO::setTitle('test',false); the defaults value of title on seotools.php is appendend. That means the final title of the page will be 'test+defaults_title'. How can i override the value on seotools.php or disable the append of the default title?

here is the seotools.php `<?php

return [ 'meta' => [ /*

isneezy commented 7 years ago

I don't know what exactly you are trying to achieve here. Do you want to disable/remove the default title on entire site or just for your controller/controller method?

iwasingh commented 7 years ago

Yes, in a certain way, i want disable/remove the default title for my controller/controller method.

isneezy commented 7 years ago

As the docs says to set the default title to false if you do not want it, so the simple way of doing that is to override it in your controller.

/**  Display the specified resource. **/
public function show(Request $request){
  config(['seotools.meta.defaults.title' => false]);
  $this->seo()->setTitle("Your title");
  return view('your.view');
}

Update If it is necessary that the controller always have to hide the title by default, simply move the configuration line to the constructor

iwasingh commented 7 years ago

Problem solved, thank you!

stefkes commented 6 years ago

If I may make a suggestion - the way this is explain in the docs is not very clear. "default" usually means the value that's used when none is explicitly set. The fact that it's appended to a value unless explicitly disabled is a little strange.

Great plugin though!