2017 © Pedro Peláez
 

library seo

SEO for laravel projects

image

travelience/seo

SEO for laravel projects

  • Saturday, August 19, 2017
  • by xpromx
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Installation

Service Provider

Add the service provider in config/app.php, (*1)

Travelience\Seo\SeoServiceProvider::class,

Alias

Add the SEO alias in config/app.php, (*2)

'SEO' => Travelience\Seo\Facades\Seo::class,`

Config Files

In order to edit the default configuration for this package you may execute:, (*3)

php artisan vendor:publish

Translation Files for routes

If you support multi-language you can use the lang folder creating a file seo.php for each language to automatically translate the SEO meta for each language., (*4)

The key is the route name for example in routes/web.php, (*5)

Route::get('/'                   , ['as' => 'home', 'uses' => 'Web\HomeController@index']);
Route::get('/about'            , ['as' => 'about', 'uses' => 'Web\AboutController@index']);
Route::get('/company/reviews'  , ['as' => 'company.reviews', 'uses' => 'Web\CompanyController@reviews']);

The translation file for the previous routes will be:, (*6)

<?php

return [

  'home' => [
                'title' => 'Home',
                'description' => '',
                'keywords' => '',
            ],

  'about' => [
                'title' => 'About'
            ],

  'company_reviews' => [
                'title' => 'Company Reviews'
            ],

];

Translations variables

Set variables to be replaced in translations automatically., (*7)

<?php

namespace App\Http\Controllers\Web;

use App\Http\Controllers\Controller;
use Travelience\Seo\Seo;

class HomeController extends Controller
{

    public function index()
    {
        SEO::set('product', 'Product Name');

        return view('home');
    }

}

MetaTags

Defaults metatags are in the config/seo.php file, but if you need to add one meta to a specific page, use the follow method:, (*8)

SEO::meta('name', 'value');

MicroFormats

If you need to set a microformat, check this example:, (*9)

```php SEO::microformat('TouristAttraction', [, (*10)

'name' => 'Asakusa', 'description' => ':description', 'aggregateRating' => [, (*11)

'@type'       => 'AggregateRating', 
'ratingValue' => '5.0' 

], (*12)

]); ````, (*13)

The Versions

19/08 2017

dev-master

9999999-dev https://github.com/xpromx/laravel-seo

SEO for laravel projects

  Sources   Download

The Requires

 

by Avatar xpromx