What is SeoTitan, how to use it, what are the benefits?

Titan Framework |03/09/2019 10:45 | 1963 show | 0 comment(s)
What is SeoTitan, how to use it, what are the benefits?

What is SeoTitan?

SeoTitan is a library that contains meta, opengraph, twittercard commands. Click to download the library.

How to install?

First, the App and System folders in Github are copied to the titan home directory. The definition of Provider and Facade is done as follows. When we call the commands we send from the controller to the required places in View, our library will be operational.

Provider Definition

To define a provider, the library's namespace is added to the providers key. To do this, open the /App/Config/Services.php page and add the required line to the relevant provider as in the following code.

'providers' => [ 
     'Seo' => 'App\Libs\SeoTitan\Seo',
],

 

Facade Definition

The namespace of the facade class created in the above example is defined in the facades key in /App/Config/Services.php.

'facades' => [ 
     'Seo' => 'System\Facades\Seo', 
],

How to use?

In order to use Seotitan, our controller page to which commands will be sent is selected. App/Controllers/Frontend/Index.php sample controller page content;

// --- [+] /App/Controllers/Frontend/Index.php --- //  
namespace App\Controllers\Frontend;  

use System\Kernel\Controller; 
use View, Seo;  

class Index extends Controller {
    public function index()
    {
        $data['meta']    = Seo::Meta('title', 'description', 'author_name');
        $data['og']      = Seo::OpenGraph('type', 'title', 'description', 'site_name', 'url', 'image_url', 'locale', 'publish_time', 'author_name');
        $data['twitter'] = Seo::TwitterCard('site_name', 'title', 'description', 'image_url');
        View::render('frontend.index.index', $data);
    } 
}

Report Reaction




Share




Subscribe


Comments (0 )

Add Comment

Enter your name, surname, email and comment, we will post at the end of the review.
Yukarı Çık