2017 © Pedro Peláez
 

library seorules

A tool for building seo rules in your Laravel projects

image

spescina/seorules

A tool for building seo rules in your Laravel projects

  • Tuesday, January 10, 2017
  • by simonpex
  • Repository
  • 1 Watchers
  • 11 Stars
  • 567 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 21 Versions
  • 0 % Grown

The README.md

Seorules

A package for building seo rules in your Laravel projects. Manage with ease SEO meta tags (title, description, keywords, noindex) of your pages., (*1)

Installation

To install Seorules in Laravel 5.1, simply run composer require spescina\seorules.
To install Seorules in Laravel 4, simply run composer require spescina\seorules 1.* and then follow these instructions., (*2)

Once it's installed, you have to register the service provider. In app/config/app.php add the following line of code to the providers array
Spescina\Seorules\SeorulesServiceProvider::class., (*3)

If you want in app/config/app.php add the following line of code to the aliases array
'Seo' => Spescina\Seorules\Facades\Seo::class., (*4)

Register the route middleware adding these line to the app/Http/Kernel.php file
'seorules.before' => \Spescina\Seorules\Init::class., (*5)

Then, publish the config file with php artisan vendor:publish --provider="Spescina\Seorules\SeorulesServiceProvider" --tag="config" .
Then, publish the migration file with php artisan vendor:publish --provider="Spescina\Seorules\SeorulesServiceProvider" --tag="migrations" ., (*6)

Then run the migration with php artisan migrate., (*7)

Usage

Define your rules creating entries in the seorules database table * alias: system identificative name of the rule * route: name of the target route * pattern: regular expression for matching page url (used for targeting different pages on the same route) * priority: highest value come first * title: title tag * description: description meta tag * keywords: keywords meta tag * noindex: noindex meta tag, (*8)

{
  alias: 'first',
  route: 'first.route',
  pattern: '',
  priority: 0,
  title: 'the first route title is [#_first_placeholder]',
  description: 'my first route description is [#_second_placeholder]',
  keywords: '[#_first_placeholder], [#_second_placeholder], laravel',
  noindex: 0
},
{
  alias: 'second',
  route: 'second.route',
  pattern: '',
  priority: 0,
  title: 'the second route title is [#_second_placeholder]',
  description: 'my second route description is empty',
  keywords: '[#_first_placeholder]',
  noindex: 1
}

Attach seorules.before middleware to your target named routes (route groups are reccomended), (*9)

Route::group(['middleware' => 'seorules.before'], function()
{
    Route::get('/first', array('as' => 'first.route', function(){
        //do things
    }));

    Route::get('/second', array('as' => 'second.route', function(){
        //do things
    }));
});

Manage your rules in your controllers or in your closures, (*10)

Seo::addPlaceholder('first_placeholder','Foo');
Seo::addPlaceholder('second_placeholder','Bar');

Display prepared fields in your views, (*11)

<title>{{ Seo::get('title') }}</title>
<meta name="description" content="{{ Seo::get('description') }}" />
<meta name="keywords" content="{{ Seo::get('keywords') }}" />
@if (Seo::get('noindex'))
<meta name="robots" content="noindex" />
@endif

Now you should have rendered this code when visiting /first (assuming both routes are prepared with same placeholder data), (*12)

<title>the first route title is Foo</title>
<meta name="description" content="my first route description is Bar" />
<meta name="keywords" content="Foo, Bar, laravel" />

and when visting /second, (*13)

<title>the second route title is Bar</title>
<meta name="description" content="my second route description is empty" />
<meta name="keywords" content="Foo" />
<meta name="robots" content="noindex" />

The Versions

10/01 2017

dev-master

9999999-dev

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

10/01 2017

2.0.3

2.0.3.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

02/12 2015

2.0.2

2.0.2.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

23/09 2015

2.0.1

2.0.1.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

23/09 2015

dev-develop

dev-develop

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

23/09 2015

1.x-dev

1.9999999.9999999.9999999-dev

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

23/09 2015

v1.3.3

1.3.3.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

15/09 2015

2.0.0

2.0.0.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

19/11 2014

v1.3.2

1.3.2.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

07/03 2014

1.3.1

1.3.1.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

07/03 2014

1.3.0

1.3.0.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

07/03 2014

1.2.2

1.2.2.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

07/03 2014

1.2.1

1.2.1.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

28/01 2014

1.2.0

1.2.0.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

22/08 2013

v1.1.5

1.1.5.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

22/08 2013

v1.1.4

1.1.4.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

22/08 2013

v1.1.3

1.1.3.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

09/08 2013

v1.1.2

1.1.2.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

08/08 2013

v1.1.1

1.1.1.0

A tool for building seo rules in your Laravel projects

  Sources   Download

MIT

The Requires

 

by Simone Pescina

database laravel page seo

08/08 2013

v1.1.0

1.1.0.0

A tool for building seo rules in your Laravel projects

  Sources   Download

The Requires

 

by Simone Pescina

database laravel page seo

08/08 2013

v1.0.0

1.0.0.0

A tool for building seo rules in your Laravel projects

  Sources   Download

The Requires

 

by Simone Pescina

database laravel page seo