TYPO3 v11 + schema extension: NewsArticle JSON-LD data via TypoScript

raw

page-article.typoscript

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
page.90 = SCHEMA
page.90 {
    #add schema only for pages with type "article"
    if.equals.field = doktype
    if.value = 12
 
    type.field = tx_schema_webpagetype
 
    properties {
        mainEntityOfPage = SCHEMA
        mainEntityOfPage {
            type = WebPage
            id.data = getIndpEnv : TYPO3_REQUEST_URL
        }
 
        headline.field = seo_title // title
 
        image = SCHEMA
        image {
            type = ImageObject
            properties {
                #take image URL from page properties > ressources > media
                url.cObject = FILES
                url.cObject {
                    references {
                        table = pages
                        uid.data = uid
                        fieldName = media
                    }
                    maxItems = 1
                    renderObj = TEXT
                    renderObj {
                        data = file:current:publicUrl
                    }
                }
            }
        }
 
        #authors are special pages, linked via the "tx_ratgeber2_author_pid" field
        author = SCHEMA
        author {
            type = Person
            properties {
                name.cObject = RECORDS
                name.cObject {
                    source.data = page:tx_ratgeber2_author_pid
                    tables = pages
                    conf.pages = TEXT
                    conf.pages.stdWrap.field = title
                }
 
                url.typolink {
                    parameter.field = tx_ratgeber2_author_pid
                    forceAbsoluteUrl = 1
                    returnLast = url
                }
            }
        }
 
        publisher = SCHEMA
        publisher {
            type = Organization
            properties {
                name = ACME Corp
 
                logo = SCHEMA
                logo {
                    type = ImageObject
                    properties {
                        url = https://example.org/acme.svg
                    }
                }
            }
        }
 
        datePublished {
            data = field:tx_ratgeber2_publication_date // field:crdate
            date = c
        }
 
        dateModified {
            data = field:lastUpdated // field:tx_ratgeber2_publication_date // field:crdate
            date = c
        }
    }
}
 
Christian Weiske Christian Weiske
owner

History