refactor: rename schemaType to itemtype, fix caching titles

This commit is contained in:
Ben Goldsworthy 2025-05-14 18:44:50 +02:00
parent 28033351c7
commit 417c38cfd1
No known key found for this signature in database
9 changed files with 27 additions and 20 deletions

View file

@ -5,7 +5,7 @@
@params sc Site context
@params pc Page context
@params items Set of items to render a list from.
@params schemaType Schema.org type to apply. Optional.
@params itemtype Schema.org type to apply. Optional.
@params listType "unordered" or "ordered". Default "unordered".
-->
@ -19,8 +19,8 @@
{{- warnf "No items passed to list partial (%q)" .pc.File.Path -}}
{{- end -}}
{{- if ( and .schemaType ( not ( in .sc.Site.Data.itemtypes .schemaType ) ) ) -}}
{{- erroridf "invalid-schemaType" "Invalid Schema.org type value %q (%q)" .schemaType .pc.File.Path -}}
{{- if ( and .itemtype ( not ( in .sc.Site.Data.itemtypes .itemtype ) ) ) -}}
{{- erroridf "invalid-itemtype" "Invalid Schema.org type value %q (%q)" .itemtype .pc.File.Path -}}
{{- end -}}
{{- if ( and .listType ( not ( in ( slice "unordered" "ordered" ) .listType ) ) ) -}}
@ -29,7 +29,7 @@
<!-- Default Assignment -->
{{- $schemaType := default "" .schemaType -}}
{{- $itemtype := default "" .itemtype -}}
{{- $listType := default "unordered" .listType -}}
<!-- Rendering -->
@ -45,7 +45,7 @@
<li itemscope itemtype="https://schema.org/Place">
{{- $k -}}
{{- if ( not ( isset $v "lat" ) ) -}}
{{- partial "util/render_recursive_list.html" ( dict "sc" $.sc "pc" $.pc "items" $v "schemaType" $schemaType "listType" $listType ) -}}
{{- partial "util/render_recursive_list.html" ( dict "sc" $.sc "pc" $.pc "items" $v "itemtype" $itemtype "listType" $listType ) -}}
{{- end -}}
</li>
{{- end -}}