Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
Rias committed Dec 7, 2017
0 parents commit 275c7c5
Show file tree
Hide file tree
Showing 11 changed files with 3,011 additions and 0 deletions.
1 change: 1 addition & 0 deletions .craftplugin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"pluginName":"schema","pluginDescription":"A fluent builder Schema.org types and ld+json generator based on Spatie's PHP schema-org package","pluginVersion":"1.0.0","pluginAuthorName":"Rias","pluginVendorName":"Rias","pluginAuthorUrl":"https://rias.be","pluginAuthorGithub":"rias500","codeComments":"","pluginComponents":["variables"],"consolecommandName":"","controllerName":"","cpsectionName":"","elementName":"","fieldName":"","modelName":"","purchasableName":"","recordName":"","serviceName":"","taskName":"","utilityName":"","widgetName":"","apiVersion":"api_version_3_0"}
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# CRAFT ENVIRONMENT
.env.php
.env.sh
.env

# COMPOSER
/vendor

# BUILD FILES
/bower_components/*
/node_modules/*
/build/*
/yarn-error.log

# MISC FILES
.cache
.DS_Store
.idea
.project
.settings
*.esproj
*.sublime-workspace
*.sublime-project
*.tmproj
*.tmproject
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
config.codekit3
prepros-6.config
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# schema Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.0.0 - 2017-12-06
### Added
- Initial release
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2017 Rias

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# 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.

## Requirements

This plugin requires Craft CMS 3.0.0-RC1 or later and PHP 7.

## Installation

To install the plugin, install it from the plugin store or follow these instructions.

1. Open your terminal and go to your Craft project:

cd /path/to/project

2. Then tell Composer to load the plugin:

composer require rias/schema

3. In the Control Panel, go to Settings → Plugins and click the “Install” button for schema.

## 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](https://github.com/spatie/schema-org).

## Using Schema

Once Schema is installed, it's accessible through the `craft` variable in your templates.

For the best experience, set the schema to a variable and typehint it to Spatie's model. In combination with the [Symfony plugin](https://plugins.jetbrains.com/plugin/7219-symfony-plugin) for PHPStorm, you get autocompletion for all the Schema's and their properties.

For example:
```
{# @var schema \Spatie\SchemaOrg\Schema #}
{% set schema = craft.schema %}
{{ schema
.person
.name("Rias Van der Veken")
.email("[email protected]")
.company(
schema.localBusiness
.name("Marbles")
.address(schema.postalAddress
.addressCountry("Belgium")
.addressLocality("Antwerp")
.addressRegion("Antwerp")
.postalCode(2000)
.streetAddress("IJzerenpoortkaai 3")
)
)
}}
```

Generates the following output:

```
<script type="application/ld+json">
{
"@context":"http:\/\/schema.org",
"@type":"Person",
"name":"Rias Van der Veken",
"email":"[email protected]",
"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](https://rias.be)
48 changes: 48 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "rias/schema",
"description": "A fluent builder Schema.org types and ld+json generator based on Spatie's schema-org package",
"type": "craft-plugin",
"version": "1.0.0",
"keywords": [
"craft",
"cms",
"craftcms",
"craft-plugin",
"schema"
],
"support": {
"docs": "https://github.com/rias500/schema/blob/master/README.md",
"issues": "https://github.com/rias500/schema/issues"
},
"license": "MIT",
"authors": [
{
"name": "Rias",
"homepage": "https://rias.be"
}
],
"require": {
"craftcms/cms": "^3.0.0-RC1",
"spatie/schema-org": "^1.4"
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
],
"autoload": {
"psr-4": {
"rias\\schema\\": "src/"
}
},
"extra": {
"name": "schema",
"handle": "schema",
"schemaVersion": "1.0.0",
"hasCpSettings": false,
"hasCpSection": false,
"changelogUrl": "https://raw.githubusercontent.com/rias500/schema/master/CHANGELOG.md",
"class": "rias\\schema\\Schema"
}
}
Loading

0 comments on commit 275c7c5

Please sign in to comment.