brotkrueml / schema

TYPO3 extension providing an API and view helpers for schema.org markup

Home Page:https://extensions.typo3.org/extension/schema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reference types via id only in Fluid templates

brotkrueml opened this issue · comments

As an integrator I want the possibility to reference types in Fluid templates.

Example in JSON-LD

[{
  "@type": "BlogPosting",
  "name": "Some title",
  "author": {
     "@id": "authorid"
  }
}, {
  "@type": "Person",
  "@id": "authorid",
  "name": "Arthur Dent",
}]

Example in Fluid

This does not work currently:

<schema:type.blogPosting name="Some posting">
    <schema:property -as="author" -id="someauthor"/>
</schema:type.blogPosting>
<schema:type.person -id="someauthor" name="Arthur Dent">

Error:

Required argument "value" was not supplied.

Acceptance criteria

  • The argument value in PropertyViewHelper is not required anymore if an id is given.
  • The rendered JSON-LD is valid (like in example above).
  • The documentation contains an example for this case.
  • A feature entry to the changelog is added.

Okay, have to read my documentation. This is possible by now with node identifiers:

<schema:type.blogPosting
    name="42"
    author="{schema:nodeIdentifier(id: 'https://example.org/#arthur-dent')}"
/>

<schema:type.person
    -id="https://example.org/#arthur-dent"
    givenName="Arthur"
    familyName="Dent"
/>

See docs: https://docs.typo3.org/p/brotkrueml/schema/2.2/en-us/Developer/ViewHelpers.html#schema-nodeidentifier-view-helper