2017 © Pedro PelĂĄez
 

typo3-cms-extension px_semantic

Structured Data Rendering for TYPO3. Easy Building of Linked Data API based on Hydra.

image

portrino/px_semantic

Structured Data Rendering for TYPO3. Easy Building of Linked Data API based on Hydra.

  • Tuesday, November 28, 2017
  • by portrino-dev
  • Repository
  • 8 Watchers
  • 7 Stars
  • 93 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 17 Versions
  • 55 % Grown

The README.md

px_semantic 2.5.0 (beta)

Latest Stable Version Total Downloads, (*1)

Structured Data Markup Rendering for TYPO3 with JSON-LD, (*2)

PxSemantic provides an extrem dynamic and highly customizable solution to embed structured data on your website and enrich them with information about your website. The currently supported classes are a subset of the vocabulary defined on https://schema.org/ and were generated with the schema generator from https://api-platform.com/. At the moment we only support json-ld format to encode LinkedData., (*3)

Before you start: * Download / Import from TER or GitHub * Install the Extension * Include Static Template Files!, (*4)

Example 1 - Render Organization Information

For example you want to markup your official website with information about your corporate contacts (https://developers.google.com/structured-data/customize/contact-points) you can do it this way:, (*5)

Declare your organization information and corporate contact via TypoScript., (*6)

TypoScript:

lib.structuredDataMarkupOrganization 

Use the TS to render the resulting JSON-LD code somewhere on your website. We put it into the <HEAD> because other meta information are also located within the <HEAD> tag. But it doesn`t matter., (*7)

Google says:, (*8)

You can embed data in a web page using schema.org field names and the new JSON-LD data format. JSON-LD is easy to produce with many widely available JSON encoders. The data, enclosed within the tags as shown in the examples below, may be placed in either the , (*9)

or region of the page that displays that event. Either way, it won't affect how your document appears in users' web browsers. -- [Google Documentation][1]
TypoScript:


page.headerData.1453734422 

If you want to put it in your template you could make use fluids cObject-ViewHelper:, (*10)

Fluid:
<f:cObject typoscriptObjectPath="lib.structuredDataMarkupOrganization"></f:cObject>

This will result in the following JSON-LD Markup on your page, (*11)

<script type="application/ld+json">
{
    "@context" : "http://schema.org",
    "@type" : "Organization",
    "areaServed":"DE"
    "url" : "http://www.your-company-site.com",
    "contactPoint" : {
        "@type" : "ContactPoint",
        "areaServed":"DE",
        "telephone" : "+49-123-456-78",
        "contactType" : "customer support"    
    },
    "logo": {
        "@type":"ImageObject",
        "url":"http://www.your-company-site.com/fileadmin/company_logo.png"
    },
    "sameAs":[
        "http:\\www.facebook.com\yourSite",
        "http:\\www.youtube.com\user\yourSite",
        "http:\\www.pinterest.com\yourSite\"
    ]
}
</script>

Example 2 - Render Multiple Entities

TypoScript:, (*12)


    lib.structuredDataMarkupExample 

Fluid:, (*13)

    <f:for each="{entities}" as="entity">
        {entity -> f:cObject(typoscriptObjectPath: 'lib.structuredDataMarkupExample')}
    </f:for>

Example 3 - Create LinkedData REST API

Since version 2.0.0 it is possible to configure an LinkedData REST API which is based on Hydra Core Vocabulary (http://www.hydra-cg.com/spec/latest/core/), (*14)

TypoScript:, (*15)

  • create a page e.g. called "api (123)" within your page tree for better realurl configuration

constants.txt, (*16)


plugin.tx_pxsemantic {
    settings {
            rest {
                pid = 123
            }
        }
    }        
}

  • now configure for each endpoint of your rest api the resource to entity mapping like in the easy example below
  • as for strcutured data markup in exampe 1 and example 2 you could (re)use processors to transform your resource (aka domain model) into an http://schema.org/ entity

setup.txt, (*17)


plugin.tx_pxsemantic {
    settings {
            rest {
                endpoints {
                    pages {
                        entity = Portrino\PxSemantic\SchemaOrg\CreativeWork
                        resource = Portrino\PxSemantic\Domain\Model\Page
                        processors {
                            0 {
                                className = Portrino\PxSemantic\Processor\PageProcessor
                            }
                        }
                    }
                }
            }
        }
    }        
}

  • add this realurl configuration for nicer uris of your rest API

realurl_conf.php, (*18)


...
  
  'fixedPostVars' => [
        '_DEFAULT' => [],
        'api' => [
            [
                'GETvar' => 'type',
                'valueMap' => [
                    'structured-data' => 1475825939,
                    'structured-data-contexts' => 1476721757,
                    'vocab' => 1476770090
                ]
            ],
            [
                'GETvar' => 'tx_pxsemantic_hydraapi[endpoint]',
                'valueMap' => [
                    'recipes' => 'recipes',
                    'pages' => 'pages'
                ],
                'noMatch' => 'bypass'
            ],
            [
                'GETvar' => 'tx_pxsemantic_hydracontext[context]',
                'valueMap' => [
                    'Entrypoint' => 'Entrypoint',
                ],
                'noMatch' => 'bypass'
            ],
            [
                'cond'        => [
                    'prevValueInList' => 'pages'
                ],
                'GETvar'      => 'tx_pxsemantic_hydraapi[uid]',
                'lookUpTable' => [
                    'table'       => 'pages',
                    'id_field'    => 'uid',
                    'alias_field' => 'uid'
                ],
                'optional'    => true
            ]
        ],
        '123' => 'api'
    ],
    
...

  • now you can call your Linked Data REST API via: http://domain.tld/api/structured-data/pages/ which will be presented as PagedCollection (http://www.hydra-cg.com/spec/latest/core/#collections), (*19)

  • add this url to hydra console (http://www.markus-lanthaler.com/hydra/console/) will give you a nice hydra documentation, (*20)

More Examples

  • Could be found under: https://github.com/portrino/px-semantic-demo, (*21)

    Authors

, (*22)

  • AndrĂ© Wuttig - Initial work, Semantic REST API, Documentation - aWuttig
  • Axel Böswetter - some more semantic.org entities - EvilBMP

See also the list of contributors who participated in this project., (*23)

The Versions

28/11 2017

dev-master

9999999-dev http://www.portrino.de

Structured Data Rendering for TYPO3. Easy Building of Linked Data API based on Hydra.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

typo3 hydra cms google semanticweb richsnippets schema org structureddata

29/08 2017

dev-development

dev-development http://www.portrino.de

Structured Data Rendering for TYPO3. Easy Building of Linked Data API based on Hydra.

  Sources   Download

GPL-2.0+

The Requires

 

typo3 hydra cms google semanticweb richsnippets schema org structureddata

29/08 2017

2.5.0

2.5.0.0 http://www.portrino.de

Structured Data Rendering for TYPO3. Easy Building of Linked Data API based on Hydra.

  Sources   Download

GPL-2.0+

The Requires

 

typo3 hydra cms google semanticweb richsnippets schema org structureddata

29/08 2017

2.4.0

2.4.0.0 http://www.portrino.de

Structured Data Rendering for TYPO3. Easy Building of Linked Data API based on Hydra.

  Sources   Download

GPL-2.0+

The Development Requires

typo3 hydra cms google semanticweb richsnippets schema org structureddata

01/06 2017

2.3.1

2.3.1.0 http://www.portrino.de

Structured Data Rendering for TYPO3. Easy Building of Linked Data API based on Hydra.

  Sources   Download

GPL-2.0+

The Development Requires

typo3 hydra cms google semanticweb richsnippets schema org structureddata

31/05 2017

2.3.0

2.3.0.0 http://www.portrino.de

Structured Data Rendering for TYPO3. Easy Building of Linked Data API based on Hydra.

  Sources   Download

GPL-2.0+

The Development Requires

typo3 hydra cms google semanticweb richsnippets schema org structureddata

11/11 2016

2.1.0

2.1.0.0 http://www.portrino.de

Structured Data Rendering for TYPO3. Easy Building of Linked Data API based on Hydra.

  Sources   Download

GPL-2.0+

The Development Requires

typo3 hydra cms google semanticweb richsnippets schema org structureddata

11/11 2016

2.0.0

2.0.0.0 http://www.portrino.de

Structured Data Rendering for TYPO3. Easy Building of Linked Data API based on Hydra.

  Sources   Download

GPL-2.0+

The Development Requires

typo3 hydra cms google semanticweb richsnippets schema org structureddata

06/10 2016

1.5.0

1.5.0.0 http://typo3.org

  Sources   Download

GPL-2.0+

The Development Requires

24/05 2016

1.4.0

1.4.0.0 http://typo3.org

  Sources   Download

GPL-2.0+

The Development Requires

17/05 2016

1.3.0

1.3.0.0 http://typo3.org

  Sources   Download

GPL-2.0+

The Development Requires

03/05 2016

1.2.3

1.2.3.0 http://typo3.org

  Sources   Download

GPL-2.0+

The Development Requires

03/03 2016

1.2.2

1.2.2.0 http://typo3.org

  Sources   Download

GPL-2.0+

The Requires

  • typo3-ter/vhs 2.4.*

 

The Development Requires

03/03 2016

1.2.1

1.2.1.0 http://typo3.org

  Sources   Download

GPL-2.0+

The Requires

  • typo3-ter/vhs 2.4.*

 

The Development Requires

25/02 2016

1.2.0

1.2.0.0 http://typo3.org

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

08/02 2016

1.1.0

1.1.0.0 http://typo3.org

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

26/01 2016

1.0.0

1.0.0.0 http://typo3.org

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires