Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetTitle always append defaults #94

Closed
iwasingh opened this issue Aug 10, 2017 · 5 comments
Closed

SetTitle always append defaults #94

iwasingh opened this issue Aug 10, 2017 · 5 comments

Comments

@iwasingh
Copy link

iwasingh commented Aug 10, 2017

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' => [
/*
* The default configurations to be used by the meta generator.
*/

    /*
     * EXCLUDE SEO ROUTES PANEL
    */
    /*
     * More about
     *    - titles at: https://moz.com/learn/seo/title-tag
     *    - description: https://moz.com/learn/seo/meta-description
     *    - canonical url: https://moz.com/blog/canonical-url-tag-the-most-important-advancement-in-seo-practices-since-sitemaps
     */
    'defaults'       => [
        'title'        => "myDefaultString", // set false to total remove
        'description'  => "MyDefaultDescription.", // set false to total remove
        'separator'    => false,
        'keywords'     => [ 'test'],
        'canonical'    => false, // Set null for using Url::current(), set false to total remove
                                 //multiple pages considered as one
    ],

    /*
     * Webmaster tags are always added.
     */
    'webmaster_tags' => [
        'google'    => null,
        'bing'      => null,
        'alexa'     => null,
        'pinterest' => null,
        'yandex'    => null,
    ],
],
'opengraph' => [
    /*
     * The default configurations to be used by the opengraph generator.
     */
   
    'defaults' => [
        'title'        => "myDefaultString", // set false to total remove
        'description'  => "MyDefaultDescription.", // set false to total remove // set false to total remove
        'url'         => false, // Set null for using Url::current(), set false to total remove
        'type'        => false,
        'site_name'   => false,
        'images'      => [],
    ],
],
'twitter' => [
    /*
     * The default values to be used by the twitter cards generator.
     */
    'defaults' => [
      //'card'        => 'summary',
      //'site'        => '@LuizVinicius73',
    ],
],

];
`

@isneezy
Copy link

isneezy commented Aug 11, 2017

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
Copy link
Author

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

@isneezy
Copy link

isneezy commented Aug 11, 2017

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
Copy link
Author

Problem solved, thank you!

@stefkes
Copy link

stefkes commented Nov 27, 2017

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants