|
7 | 7 | {{- $siteTitle := .Site.Title | default "Site" -}} |
8 | 8 | {{- $orgId := printf "%s#org" $siteURL -}} |
9 | 9 | {{- $websiteId := printf "%s#website" $siteURL -}} |
| 10 | +{{- $blogId := printf "%s#blog" $siteURL -}} |
10 | 11 | {{- $logoId := printf "%s#logo" $siteURL -}} |
11 | 12 |
|
12 | 13 | {{- $logoURL := .Site.Params.avatar -}} |
|
115 | 116 | -}} |
116 | 117 | {{- $nodes = $nodes | append $website -}} |
117 | 118 |
|
| 119 | +{{- $siteDescription := .Site.Params.descriptionLong | default .Site.Params.description -}} |
| 120 | +{{- $blogNode := dict |
| 121 | + "@type" "Blog" |
| 122 | + "@id" $blogId |
| 123 | + "name" $siteTitle |
| 124 | + "url" $siteURL |
| 125 | + "isPartOf" (dict "@id" $websiteId) |
| 126 | + "publisher" (dict "@id" $orgId) |
| 127 | +-}} |
| 128 | +{{- if $siteDescription -}} |
| 129 | + {{- $blogNode = merge $blogNode (dict "description" $siteDescription) -}} |
| 130 | +{{- end -}} |
| 131 | +{{- if $personName -}} |
| 132 | + {{- $blogNode = merge $blogNode (dict "author" (dict "@id" $personId)) -}} |
| 133 | +{{- end -}} |
| 134 | +{{- $languageCode := .Site.Language.LanguageCode | default .Site.Language.Lang | default .Site.LanguageCode -}} |
| 135 | +{{- if $languageCode -}} |
| 136 | + {{- $blogNode = merge $blogNode (dict "inLanguage" $languageCode) -}} |
| 137 | +{{- end -}} |
| 138 | +{{- $nodes = $nodes | append $blogNode -}} |
| 139 | + |
118 | 140 | {{- if $personName -}} |
119 | 141 | {{- $personNode := dict |
120 | 142 | "@type" "Person" |
|
147 | 169 | "name" $webpageName |
148 | 170 | "isPartOf" (dict "@id" $websiteId) |
149 | 171 | -}} |
150 | | -{{- $languageCode := .Site.Language.LanguageCode | default .Site.Language.Lang | default .Site.LanguageCode -}} |
151 | 172 | {{- if $languageCode -}} |
152 | 173 | {{- $webpageNode = merge $webpageNode (dict "inLanguage" $languageCode) -}} |
153 | 174 | {{- end -}} |
| 175 | + |
| 176 | +{{- $isPostList := or .IsHome (and (eq .Kind "section") (eq .Section "posts")) -}} |
| 177 | +{{- if $isPostList -}} |
| 178 | + {{- $pageSize := 5 -}} |
| 179 | + {{- $posts := where .Site.RegularPages "Section" "posts" -}} |
| 180 | + {{- $paginator := .Paginate $posts $pageSize -}} |
| 181 | + {{- $listPages := $paginator.Pages -}} |
| 182 | + {{- if gt (len $listPages) 0 -}} |
| 183 | + {{- $itemListId := printf "%s#itemlist" $pageURL -}} |
| 184 | + {{- $itemListElements := slice -}} |
| 185 | + {{- range $index, $page := $listPages -}} |
| 186 | + {{- $itemListElements = $itemListElements | append (dict |
| 187 | + "@type" "ListItem" |
| 188 | + "position" (add $index 1) |
| 189 | + "item" (dict "@id" $page.Permalink "name" $page.Title) |
| 190 | + ) -}} |
| 191 | + {{- end -}} |
| 192 | + {{- $itemListNode := dict |
| 193 | + "@type" "ItemList" |
| 194 | + "@id" $itemListId |
| 195 | + "itemListElement" $itemListElements |
| 196 | + "numberOfItems" (len $listPages) |
| 197 | + -}} |
| 198 | + {{- $webpageNode = merge $webpageNode (dict "mainEntity" (dict "@id" $itemListId)) -}} |
| 199 | + {{- $nodes = $nodes | append $itemListNode -}} |
| 200 | + {{- end -}} |
| 201 | +{{- end -}} |
| 202 | + |
154 | 203 | {{- $nodes = $nodes | append $webpageNode -}} |
155 | 204 |
|
156 | | -{{- if eq .Section "posts" -}} |
| 205 | +{{- if and .IsPage (eq .Section "posts") -}} |
157 | 206 | {{- $imageURL := "" -}} |
158 | 207 | {{- with .Params.cover.image -}} |
159 | 208 | {{- with $.Resources.GetMatch . -}} |
|
174 | 223 | "headline" .Title |
175 | 224 | "datePublished" (.Date.Format "2006-01-02T15:04:05Z07:00") |
176 | 225 | "mainEntityOfPage" (dict "@id" $webpageId) |
| 226 | + "isPartOf" (dict "@id" $blogId) |
177 | 227 | "publisher" (dict "@id" $orgId) |
178 | 228 | -}} |
179 | 229 | {{- if $personName -}} |
|
0 commit comments