2017 © Pedro Peláez
 

craft-plugin craft-schema

A fluent builder Schema.org types and ld+json generator based on Spatie's schema-org package

image

rias/craft-schema

A fluent builder Schema.org types and ld+json generator based on Spatie's schema-org package

  • Monday, July 30, 2018
  • by Rias500
  • Repository
  • 1 Watchers
  • 18 Stars
  • 1,080 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 61 % Grown

The README.md

Icon, (*1)

Latest Version Quality Score StyleCI Total Downloads, (*2)

Schema plugin for Craft CMS 3.x

A fluent builder of Schema.org types and ld+json generator based on Spatie's schema-org package which makes for a fast and easy way to add structured data to your templates., (*3)

Support Open Source. Buy beer.

This plugin is licensed under a MIT license, which means that it's completely free open source software, and you can use it for whatever and however you wish. If you're using it and want to support the development, buy me a beer over at Beerpay!, (*4)

Beerpay, (*5)

Requirements

This plugin requires Craft CMS 3.0.0-RC1 or later and PHP 7., (*6)

Installation

To install the plugin, install it from the plugin store or follow these instructions., (*7)

  1. Open your terminal and go to your Craft project:, (*8)

    cd /path/to/project
  2. Then tell Composer to load the plugin:, (*9)

    composer require rias/craft-schema
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for schema., (*10)

Schema Overview

Schema provides a fluent builder for all Schema.org types and their properties. For more information and the available methods, check out spatie/schema-org., (*11)

Using Schema

Once Schema is installed, it's accessible through the craft variable in your templates., (*12)

For the best experience, set the schema to a variable and typehint it to Spatie's model. In combination with the Symfony plugin for PHPStorm, you get autocompletion for all the Schema's and their properties., (*13)

For example:, (*14)

{# @var schema \Spatie\SchemaOrg\Schema #}
{% set schema = craft.schema %}
{{ schema
    .person
      .name("Rias Van der Veken")
      .email("hello@rias.be")
      .company(
        schema.localBusiness
          .name("Marbles")
          .address(schema.postalAddress
            .addressCountry("Belgium")
            .addressLocality("Antwerp")
            .addressRegion("Antwerp")
            .postalCode(2000)
            .streetAddress("IJzerenpoortkaai 3")
          )
      ) | raw
}}

Generates the following output:, (*15)

<script type="application/ld+json">
{  
   "@context":"http:\/\/schema.org",
   "@type":"Person",
   "name":"Rias Van der Veken",
   "email":"hello@rias.be",
   "company":{  
      "@type":"LocalBusiness",
      "name":"Marbles",
      "address":{  
         "@type":"PostalAddress",
         "addressCountry":"Belgium",
         "addressLocality":"Antwerp",
         "addressRegion":"Antwerp",
         "postalCode":2000,
         "streetAddress":"IJzerenpoortkaai 3"
      }
   }
}
</script>

Brought to you by Rias, (*16)

The Versions

30/07 2018

dev-master

9999999-dev

A fluent builder Schema.org types and ld+json generator based on Spatie's schema-org package

  Sources   Download

MIT

The Requires

 

schema cms craftcms craft-plugin craft

14/01 2018

1.0.3

1.0.3.0

A fluent builder Schema.org types and ld+json generator based on Spatie's schema-org package

  Sources   Download

MIT

The Requires

 

schema cms craftcms craft-plugin craft

08/01 2018

1.0.2

1.0.2.0

A fluent builder Schema.org types and ld+json generator based on Spatie's schema-org package

  Sources   Download

MIT

The Requires

 

schema cms craftcms craft-plugin craft

07/12 2017

1.0.0

1.0.0.0

A fluent builder Schema.org types and ld+json generator based on Spatie's schema-org package

  Sources   Download

MIT

The Requires

 

schema cms craftcms craft-plugin craft