2017 © Pedro Peláez
 

library laravel-seo

SEO integration for Laravel

image

wuifdesign/laravel-seo

SEO integration for Laravel

  • Saturday, November 28, 2015
  • by wuif
  • Repository
  • 2 Watchers
  • 5 Stars
  • 484 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 3 Versions
  • 1 % Grown

The README.md

Laravel SEO

  • Laravel: 5.1

This package includes a helper for SEO Meta tags (Meta, OpenGraph, Twitter) and rendering schema blocks., (*1)

Installation

Firstly you want to include this package in your composer.json file,, (*2)

"require": {
    "wuifdesign/laravel-seo": "0.1.*"
}

and update or install via composer:, (*3)

composer update

Or you can just run:, (*4)

composer require wuifdesign/laravel-seo

Next you open up app/config/app.php and add, (*5)

providers' => [
     WuifDesign\SEO\ServiceProvider::class
]

If you want to use the facade you should also add the following to the file, (*6)

'aliases' => [
    'SEOTool'=> \WuifDesign\SEO\Facades\SEOTool::class,
],

Now you should run, (*7)

php artisan vendor:publish

to copy the config file to app/config/seo.php., (*8)

After running the command, the config file will look like the following:, (*9)

return array(

    'enable_logging' => false,
    'used_prefixes'  => array('og'),

    'meta' =>  array(
        'title_styling' => '%title% - %subtitle%',
        'page_title'       => '123',

        'tags' => array(
            'title' => null,
            'description' => null,
            'author'      => array(null, 'rel'),
        ),

        'webmaster_tags' => array(
            'google'    => null,
            'bing'      => null,
            'alexa'     => null,
            'pinterest' => null,
            'yandex'    => null,
        ),
    ),

    'opengraph' =>  array(
        'tags' => array(
            'title'       => '',
            'description' => '',
            'url'         => null,
            'type'        => null,
            'site_name'   => null,
            'images'      => array(),
        ),
    ),

    'twitter' =>  array(
        'tags' => array(
            'card'        => null,
            'title'       => null,
            'description' => null,
            'site'        => null,
            'creator'     => null,
            'url'         => null,
            'images'      => array(),
        ),
    ),

    'schema' =>  array(
        'organization' => array(
            'type'   => 'Organization',
            'tags' => array(
                'name'    => null,
                'address' => array(
                    'type'           => 'PostalAddress',
                    'tags' => array(
                        'streetAddress'   => null,
                        'postalCode'      => null,
                        'addressLocality' => null,
                        'addressCountry' =>  null,
                    ),
                ),
                'geo'  => array(
                    'type'     => 'GeoCoordinates',
                    'hidden'   => true,
                    'tags' => array(
                        'latitude'  => null,
                        'longitude' => null,
                    ),
                ),
                'telephone' => null,
                'faxNumber' => null,
                'email'     => null,
            ),

        ),
    ),

);

You can now add strings for the tags, and if you want to set the attribute for the element, you can parse an array:, (*10)

'name' => array($value, $attribute)

Usage

Meta

Add Title/description using:, (*11)

SEOTool::setTitle('Title');
SEOTool::setDescription('Description');
SEOTool::addImage('http://example.com/hello-world.jpg');

If you want to render all SEO Tags using Blade just add the following to your <head> section., (*12)

{!! SEOTool::render() !!}

If you just want to add a metadata to a single meta type you can also use, (*13)

SEOTool::metatags()->setTitle('Title');
SEOTool::opengraph()->setTitle('Title');
SEOTool::twitter()->setTitle('Title');

Or if you just want to add a custom tag use, (*14)

SEOTool::metatags()->addProperty($key, $value[, $name]);
SEOTool::opengraph()->addProperty($key, $value[, $name]);
SEOTool::twitter()->addProperty($key, $value[, $name]);

To render all prefixes defined in the config use (available prefixes: 'og', 'fb', 'music', 'video', 'article', 'book', 'website'), (*15)

<html prefix="{{ SEOTool::renderPrefixes() }}">

Schema

You can define as many schemas as you like in the config file. To display the schema just add the following code., (*16)

{!! SEOTool::renderSchema($key) !!}

The Versions

28/11 2015

dev-master

9999999-dev

SEO integration for Laravel

  Sources   Download

MIT

The Requires

 

by Michael Wohlfahrter

laravel seo

28/11 2015

v0.1.1

0.1.1.0

SEO integration for Laravel

  Sources   Download

MIT

The Requires

 

by Michael Wohlfahrter

laravel seo

22/08 2015

v0.1.0

0.1.0.0

SEO integration for Laravel

  Sources   Download

MIT

The Requires

 

by Michael Wohlfahrter

laravel seo