cinghie/yii2-seo-component

Yii2 Component to manage SEO data and metadata

Installs: 1 049

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 1

Open Issues: 0

Type:yii2-extension

1.1.0 2019-04-13 13:43 UTC

This package is auto-updated.

Last update: 2024-12-08 12:18:20 UTC


README

License Latest Stable Version Latest Release Date Latest Commit Total Downloads

Yii2 Component to manage SEO data and metadata

Features

  • setTitle
  • setCanonical
  • setDescription
  • setKeywords
  • setAuthor
  • setCopyright
  • setRobots
  • setOpenGraphTitle
  • setOpenGraphType
  • setOpenGraphSiteName
  • setOpenGraphDescription
  • setOpenGraphUrl
  • setOpenGraphImage
  • setOpenGraphLocale
  • setFacebookAppId
  • setFacebookPageId
  • setMetaTags
  • setOpenGraph
  • setSocialApp
  • setVerifyCodes
  • setSchemaScript

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require cinghie/yii2-seo-component "*"

or add

"cinghie/yii2-seo-component": "*"

Configuration

'components' => [ 

    'seo' => [
        'class' => 'cinghie\seo\Seo'
    ],
    
]

Usage

Set Verify Codes

Yii::$app->seo->setMetaTags([
    'title' => $this->title, // default: $this->title
    'author' => '', // default: Yii::$app->settings->get('siteAuthor', 'Configurations')
    'copyright' => '', // default: Yii::$app->settings->get('siteCopyright', 'Configurations') 
    'description' => '', // default: Yii::$app->settings->get('siteDescription', 'Configurations')
    'keywords' => '', // default: Yii::$app->settings->get('siteKeywords', 'Configurations')
    'robots' => '',
]);

Set OpenGraph

Yii::$app->seo->setOpenGraph([
    'title' => $this->title, // default: $this->title
    'description' => '', // default: Yii::$app->settings->get('siteDescription', 'Configurations')
    'image' => $this->image, // default: null
    'sitename' => '', // default: Yii::$app->settings->get('siteName', 'Configurations')
    'type' => 'article', // default: 'article'
    'url' => '', // default: Yii::$app->request->absoluteUrl
]);

Set Social APP

Yii::$app->seo->setSocialAPP([
    'fb:app_id' => 'FACEBOOK_APP_ID',
    'apple-itunes-app' => 'APPLE_ITUNE_APP',
    'google-play-app' => 'GOOGLE_PLAY_APP',
]);

Set Verify Codes

Yii::$app->seo->setVerifyCodes([
	'alexaVerify' => 'ALEXA_VERIFY_CODE',
	'bingVerify' => 'BING_VERIFY_CODE',
	'googleVerify' => 'GOOGLE_VERIFY_CODE',
	'yandexVerify' => 'YANDEX_VERIFY_CODE',
]);

Set Script Schema.org

Yii::$app->seo->setSchemaScript([
	'NAME',
	'EMAIL',
	'URL',
	'LOGO',
	'TYPE',
]);