2017 © Pedro Peláez
 

library seo

image

quintype/seo

  • Tuesday, March 27, 2018
  • by quintype
  • Repository
  • 55 Watchers
  • 0 Stars
  • 14,913 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 38 Versions
  • 3 % Grown

The README.md

quintype-seo-php

A composer package for SEO for all quintype projects, (*1)

Important : If any change is made to the package, do the following.

  • Create a new release.
  • Update the package in Packagist.
  • To use the new version of the package in any project, change the version number in composer.json file and run $ composer update

Note : We are making use of a package called Meta (https://github.com/quintype/meta) forked from https://github.com/RyanNielson/meta for dynamically adding the meta tags into the pages., (*2)

Instructions to include the package into a project., (*3)

In composer.json, require Meta and SEO packages.

"require": {
        ...
        ...
        "quintype/seo":"1.0.0",
        "quintype/meta":"2.0.0"
    },

Install or update the composer packages.

$ composer install
or
$ composer update

In the Laravel config/app.php file, add aliases to the packages for convenience.

'aliases' => [
        ...
        ...
        'Meta' => Quintype\Meta\Meta::class,
        'Seo' => Quintype\Seo\Seo::class
    ],

Add an attribute called 'title' in config/quintype.php file as a fall-back value if it is not received from the config API.

return [
    ...
    ...
    "title" => "Pina Colada"
];

Include both Meta and SEO classes in the necessary controllers.

use Meta;
use Seo;

Create a constructor function to initialize the Meta and SEO objects. Do not forget to pass the config(merge local config and config from API response) while initializing the Seo instance.

public function __construct(){
  $this->client = new Api(config("quintype.api-host"));
  $this->config = array_merge($this->client->config(), config('quintype'));
  $this->meta = new Meta();
  $this->seo = new Seo($this->config);
}

Prepare the data required for meta tags using these available functions.

$setSeo = $this->seo->FUNCTION_NAME($args);
$this->meta->set($setSeo->prepareTags());

In the function to render the view, pass the meta data.

return view('home', $this->toView([
      ...
      ...
      "meta" => $this->meta
    ])
  );

-tag-of-layouttwig-fileor-the-container-twig-file-of-the-project,-call-the-function-to-add-the-meta-tags">In the <head> tag of layout.twig file(or the container twig file of the project), call the function to add the meta tags.

{{ meta.display([], true)|raw }}

AVAILABLE FUNCTIONS

  • home($pageType), (*4)

  • search($searchKeyword), (*5)

  • section($pageType, $sectionName, $sectionId), (*6)

  • staticPage($title), (*7)

  • story($pageType, $storyArray), (*8)

  • tag($tagName), (*9)

The Versions

27/03 2018

dev-master

9999999-dev

  Sources   Download

27/03 2018

1.9.2

1.9.2.0

  Sources   Download

23/02 2018

1.9.1

1.9.1.0

  Sources   Download

09/02 2018

1.9.0

1.9.0.0

  Sources   Download

19/12 2017

1.8.1

1.8.1.0

  Sources   Download

10/11 2017

1.8.0

1.8.0.0

  Sources   Download

08/11 2017

1.7.0

1.7.0.0

  Sources   Download

08/11 2017

1.6.0

1.6.0.0

  Sources   Download

03/10 2017

1.5.4

1.5.4.0

  Sources   Download

28/09 2017

1.5.3

1.5.3.0

  Sources   Download

05/09 2017

1.5.2

1.5.2.0

  Sources   Download

29/08 2017

1.5.1

1.5.1.0

  Sources   Download

16/08 2017

1.5.0

1.5.0.0

  Sources   Download

24/07 2017

1.4.1

1.4.1.0

  Sources   Download

31/05 2017

1.4.0

1.4.0.0

  Sources   Download

30/05 2017

1.3.1

1.3.1.0

  Sources   Download

26/05 2017

1.3.0

1.3.0.0

  Sources   Download

30/03 2017

1.2.0

1.2.0.0

  Sources   Download

30/03 2017

1.1.1

1.1.1.0

  Sources   Download

20/01 2017

1.1.0

1.1.0.0

  Sources   Download

18/01 2017

dev-structured-data

dev-structured-data

  Sources   Download

05/01 2017

1.0.3

1.0.3.0

  Sources   Download

04/01 2017

1.0.2

1.0.2.0

  Sources   Download

04/01 2017

1.0.1

1.0.1.0

  Sources   Download

14/10 2016

1.0.0

1.0.0.0

  Sources   Download

15/09 2016

0.0.13

0.0.13.0

  Sources   Download

15/09 2016

0.0.12

0.0.12.0

  Sources   Download

14/09 2016

0.0.11

0.0.11.0

  Sources   Download

13/09 2016

0.0.10

0.0.10.0

  Sources   Download

08/09 2016

0.0.9

0.0.9.0

  Sources   Download

08/09 2016

0.0.8

0.0.8.0

  Sources   Download

30/08 2016

0.0.7

0.0.7.0

  Sources   Download

30/08 2016

0.0.6

0.0.6.0

  Sources   Download

26/08 2016

0.0.5

0.0.5.0

  Sources   Download

26/08 2016

0.0.4

0.0.4.0

  Sources   Download

26/08 2016

0.0.3

0.0.3.0

  Sources   Download

25/08 2016

0.0.2

0.0.2.0

  Sources   Download

25/08 2016

0.0.1

0.0.1.0

  Sources   Download