Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ptheofan/yii2-meta
yii2 extension to automate the page meta tags via db entries for SEO optimisation and a less interruptive dev time.
https://github.com/ptheofan/yii2-meta
Last synced: about 2 months ago
JSON representation
yii2 extension to automate the page meta tags via db entries for SEO optimisation and a less interruptive dev time.
- Host: GitHub
- URL: https://github.com/ptheofan/yii2-meta
- Owner: ptheofan
- Created: 2014-10-23T15:08:50.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-30T08:52:12.000Z (about 10 years ago)
- Last Synced: 2024-08-09T21:42:21.566Z (5 months ago)
- Language: PHP
- Size: 156 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Web Page Metadata
=================
DB based web page metadata for SEO performance annoying free development.What's next
-----------
Take into account the route named parameters, done
Enable regex based acceptance criteria for the named parametersInstallation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist ptheofan/yii2-meta "*"
```or add
```
"ptheofan/yii2-meta": "*"
```to the require section of your `composer.json` file.
Usage
-----Basic Usage
In your components configuration add the following
```php
'meta' => [
'class' => 'ptheofan\meta\Meta',
]
```run the migration by running
```
./yii migrate --migrationPath="@vendor/ptheofan/yii2-meta/migrations"
```In your code, if you want to automatically set the metadata for a page call
```php
Yii::$app->meta->setMeta();
```
This will automatically load the correct row from the database using the currently running
route (module/controller/action or controller/action).
It will automatically identify and set the canonical, the og:url. The reset depend on the database entry,
the argument used and the defaults as identified in your component config.You can optionally override data by specifying them in a parameter array
```php
Yii::$app->meta->setMeta(['title' => 'My cool override']);
```or you can use defaults to be used throughout the site in the component config
```php
'meta' => [
'class' => 'ptheofan\meta\Meta',
'defaults' => [
'og:type' => 'website',
'author' => 'My Cool Company',
],
]
```The defaults will always override any values passed in through parameter or through the database.