diff --git a/README.md b/README.md index a0885234..90f9a17b 100644 --- a/README.md +++ b/README.md @@ -340,6 +340,17 @@ disable_toc = false # url = "https://example.com" base_schema = {} +# paige.page.microdata specifies the SEO microdata non-property attributes (all except itemprop) for the web page. +# +# Example: +# +# [paige.page.microdata] +# itemid = "123" +# itemref = "foo" +# itemscope = "" +# itemtype = "https://schema.org/Chapter +microdata = {} + # paige.page.schemas is the page JSON-LD schemas. # # Examples: @@ -453,6 +464,9 @@ or for pages with `paige.pages.schemas`, at the site or page level. A base schema can be specified for site schemas with `paige.site.base_schema`, and for page schemas with `paige.page.base_schema`. +HTML microdata is generated from the page parameters +if the non-property attributes are specified in `paige.page.microdata`. + ## Layouts ### Cloud diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index b5be4afd..667f82e3 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,5 +1,14 @@ {{ $page := . }} +{{ $itemattrs := slice }} +{{ $microdata := $page.Params.paige.page.microdata }} + +{{ range $k, $v := $microdata }} + {{ $itemattrs = $itemattrs | append (printf `%s="%v"` $k $v) }} +{{ end }} + +{{ $itemattrs = delimit (sort $itemattrs) " " }} + {{ partial "paige/tag-html.html" $page }} {{ partial "paige/tag-head.html" $page }} @@ -10,7 +19,7 @@
{{ . }}
+{{ . }}
{{ end }} {{ if or $authors $date $keywords $readingtime $series }} @@ -49,11 +50,11 @@ {{- if $textkeywords -}} {{- if gt $i 0 }} · {{ end -}} - {{ .Title }} + {{ .Title }} {{- else -}} {{- if gt $i 0 }} {{ end -}} - {{ .Title }} + {{ .Title }} {{- end -}} {{- end }} @@ -64,7 +65,7 @@ {{ range $i, $series := . -}} {{- if gt $i 0 }} · {{ end -}} - {{ .Title }} + {{ .Title }} {{- end }} {{ end }} @@ -74,19 +75,19 @@ {{ range $i, $author := . -}} {{- if gt $i 0 }} · {{ end -}} - {{ .Title }} + {{ .Title }} {{- end }} {{ end }} {{ with $date }}- +
{{ end }} {{ with $readingtime }} -{{ . }} {{ i18n "paige_minutes" . }}
+{{ . }} {{ i18n "paige_minutes" . }}
{{ end }}{{ . }}
+{{ . }}
{{ end }} {{ with $license }}