refactor: rename schemaType
to itemtype
, fix caching titles
This commit is contained in:
parent
28033351c7
commit
417c38cfd1
9 changed files with 27 additions and 20 deletions
|
@ -80,8 +80,9 @@
|
||||||
border-end-start-radius: 10px;
|
border-end-start-radius: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
text-decoration: none !important;
|
text-decoration: none !important;
|
||||||
line-height: 1.8em;
|
line-height: 1.2em;
|
||||||
background-color: #ebebeb;
|
background-color: #ebebeb;
|
||||||
|
padding-block: 0.25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
& hgroup {
|
& hgroup {
|
||||||
|
|
|
@ -7,8 +7,9 @@ resources:
|
||||||
- name: lena
|
- name: lena
|
||||||
src: images/lena.*
|
src: images/lena.*
|
||||||
params:
|
params:
|
||||||
alt: Woman smiling
|
alt: Well-known Standard Test Image "Lenna"
|
||||||
attr:
|
attr: Playboy
|
||||||
|
attrlink: https://en.wikipedia.org/wiki/File:Lenna_(test_image).png
|
||||||
---
|
---
|
||||||
|
|
||||||
## HTML
|
## HTML
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
style="width: 100%; height: 500px; margin: 0; display: block;"
|
style="width: 100%; height: 500px; margin: 0; display: block;"
|
||||||
></div>
|
></div>
|
||||||
|
|
||||||
{{- with ( partial "util/render_recursive_list.html" ( dict "sc" $ "pc" . "items" $.Site.Data.locations "schemaType" "Place" ) ) -}}
|
{{- with ( partial "util/render_recursive_list.html" ( dict "sc" $ "pc" . "items" $.Site.Data.locations "itemtype" "Place" ) ) -}}
|
||||||
<section style="grid-area: section-content">
|
<section style="grid-area: section-content">
|
||||||
{{- . -}}
|
{{- . -}}
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
@params cite URI for work. Optional.
|
@params cite URI for work. Optional.
|
||||||
@params citeStyle Force a citation style. Optional.
|
@params citeStyle Force a citation style. Optional.
|
||||||
@params href URI for citation, or 'asCite' to use value of `cite`. Optional.
|
@params href URI for citation, or 'asCite' to use value of `cite`. Optional.
|
||||||
@params schemaType The Schema.org `itemtype` value. Default 'CreativeWork'.
|
@params itemtype The Schema.org `itemtype` value. Default 'CreativeWork'.
|
||||||
@params shortTitle Abbreviated display title. Optional.
|
@params shortTitle Abbreviated display title. Optional.
|
||||||
@params title Title of the work to display.
|
@params title Title of the work to display.
|
||||||
@params titleLang Language code of a foreign-language work's title. Optional.
|
@params titleLang Language code of a foreign-language work's title. Optional.
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
{{- $title := trim ( default .Params.title ( .Scratch.Get "title" ) | .Page.RenderString ) "\r\n" -}}
|
{{- $title := trim ( default .Params.title ( .Scratch.Get "title" ) | .Page.RenderString ) "\r\n" -}}
|
||||||
{{- $titleLang := default .Params.titleLang ( .Scratch.Get "titleLang" ) -}}
|
{{- $titleLang := default .Params.titleLang ( .Scratch.Get "titleLang" ) -}}
|
||||||
{{- $titleTr := default .Params.titleTr ( .Scratch.Get "titleTr" ) -}}
|
{{- $titleTr := default .Params.titleTr ( .Scratch.Get "titleTr" ) -}}
|
||||||
{{- $schemaType := default .Params.schemaType ( .Scratch.Get "schemaType" ) -}}
|
{{- $itemtype := default .Params.itemtype ( .Scratch.Get "itemtype" ) -}}
|
||||||
|
|
||||||
{{- if ( strings.Contains $cite "#" ) -}}
|
{{- if ( strings.Contains $cite "#" ) -}}
|
||||||
{{- erroridf "cite-with-fragment" "Cite parameter includes fragment identifier, which probably isn't what you want." -}}
|
{{- erroridf "cite-with-fragment" "Cite parameter includes fragment identifier, which probably isn't what you want." -}}
|
||||||
|
@ -35,8 +35,8 @@
|
||||||
|
|
||||||
<!-- TODO: check `.Params.href` is URI or 'asCite' -->
|
<!-- TODO: check `.Params.href` is URI or 'asCite' -->
|
||||||
|
|
||||||
{{- if ( and $schemaType ( not ( in $.Site.Data.itemtypes $schemaType ) ) ) -}}
|
{{- if ( and $itemtype ( not ( in $.Site.Data.itemtypes $itemtype ) ) ) -}}
|
||||||
{{- erroridf "invalid-schemaType" "Invalid Schema.org type value %q for %q" $schemaType $title -}}
|
{{- erroridf "invalid-itemtype" "Invalid Schema.org type value %q for %q" $itemtype $title -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
<!-- TODO: check `.Params.cite` is URI -->
|
<!-- TODO: check `.Params.cite` is URI -->
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
<!-- Rendering -->
|
<!-- Rendering -->
|
||||||
{{- $itemType := default "CreativeWork" $schemaType -}}
|
{{- $itemType := default "CreativeWork" $itemtype -}}
|
||||||
{{- if ( or ( in $.Site.Data.itemtypes $itemType ) ( eq .Params.suppress "true" ) ) -}}
|
{{- if ( or ( in $.Site.Data.itemtypes $itemType ) ( eq .Params.suppress "true" ) ) -}}
|
||||||
{{- with .Params.href -}}
|
{{- with .Params.href -}}
|
||||||
<a href="{{- if eq . "asCite" -}}{{- $cite -}}{{- else -}}{{- . -}}{{- end -}}">
|
<a href="{{- if eq . "asCite" -}}{{- $cite -}}{{- else -}}{{- . -}}{{- end -}}">
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
{{- .RelPermalink -}}
|
{{- .RelPermalink -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- .RelPermalink -}}
|
{{- .img.RelPermalink -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
|
@ -37,8 +37,13 @@
|
||||||
class="article-header__featured-image"
|
class="article-header__featured-image"
|
||||||
{{ with .pc.Params.featured_image }}
|
{{ with .pc.Params.featured_image }}
|
||||||
{{ with ( $.pc.Resources.GetMatch . ) }}
|
{{ with ( $.pc.Resources.GetMatch . ) }}
|
||||||
style="background-image: url({{ partialCached "images/get-image.html" ( dict "img" . ) $.pc }})"
|
style="background-image: url({{ partial "images/get-image.html" ( dict "img" . ) }})"
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
{{- if $.pc.Page.Resources -}}
|
||||||
|
{{- errorf "No Page Resource found for src '%q' (%q).\n\n\tAvailable Page Resources are:\n\t\t%v" . $.pc.Page.File.Path $.pc.Page.Resources -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- warnf "No Page Resource found for src '%q' (%q)." . $.pc.Page.File.Path -}}
|
||||||
|
{{- end -}}
|
||||||
style="background-image: url({{ . }})"
|
style="background-image: url({{ . }})"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
@ -50,7 +55,7 @@
|
||||||
href="{{ .pc.Permalink }}"
|
href="{{ .pc.Permalink }}"
|
||||||
></a>
|
></a>
|
||||||
{{- with .pc.File -}}
|
{{- with .pc.File -}}
|
||||||
{{- partialCached "text/item-title.html" ( dict "pc" $.pc "sc" $.sc "class" "article-header" ) .Filename -}}
|
{{- partial "text/item-title.html" ( dict "pc" $.pc "sc" $.sc "class" "article-header" ) -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- partial "text/item-title.html" ( dict "pc" $.pc "sc" $.sc "class" "article-header" ) -}}
|
{{- partial "text/item-title.html" ( dict "pc" $.pc "sc" $.sc "class" "article-header" ) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
@params sc Site context
|
@params sc Site context
|
||||||
@params pc Page context
|
@params pc Page context
|
||||||
@params items Set of items to render a list from.
|
@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".
|
@params listType "unordered" or "ordered". Default "unordered".
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@
|
||||||
{{- warnf "No items passed to list partial (%q)" .pc.File.Path -}}
|
{{- warnf "No items passed to list partial (%q)" .pc.File.Path -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- if ( and .schemaType ( not ( in .sc.Site.Data.itemtypes .schemaType ) ) ) -}}
|
{{- if ( and .itemtype ( not ( in .sc.Site.Data.itemtypes .itemtype ) ) ) -}}
|
||||||
{{- erroridf "invalid-schemaType" "Invalid Schema.org type value %q (%q)" .schemaType .pc.File.Path -}}
|
{{- erroridf "invalid-itemtype" "Invalid Schema.org type value %q (%q)" .itemtype .pc.File.Path -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- if ( and .listType ( not ( in ( slice "unordered" "ordered" ) .listType ) ) ) -}}
|
{{- if ( and .listType ( not ( in ( slice "unordered" "ordered" ) .listType ) ) ) -}}
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
<!-- Default Assignment -->
|
<!-- Default Assignment -->
|
||||||
|
|
||||||
{{- $schemaType := default "" .schemaType -}}
|
{{- $itemtype := default "" .itemtype -}}
|
||||||
{{- $listType := default "unordered" .listType -}}
|
{{- $listType := default "unordered" .listType -}}
|
||||||
|
|
||||||
<!-- Rendering -->
|
<!-- Rendering -->
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
<li itemscope itemtype="https://schema.org/Place">
|
<li itemscope itemtype="https://schema.org/Place">
|
||||||
{{- $k -}}
|
{{- $k -}}
|
||||||
{{- if ( not ( isset $v "lat" ) ) -}}
|
{{- 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 -}}
|
{{- end -}}
|
||||||
</li>
|
</li>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
@see partials/cite.html for full list of args.
|
@see partials/cite.html for full list of args.
|
||||||
|
|
||||||
For works cited that form part of a series (optional):
|
For works cited that form part of a series (optional):
|
||||||
@params schemaTypeSeries The Schema.org `itemtype` value for the work series. Default 'CreativeWork'. Optional.
|
@params itemtypeSeries The Schema.org `itemtype` value for the work series. Default 'CreativeWork'. Optional.
|
||||||
@params titleSeries Title of the work series to display. Optional.
|
@params titleSeries Title of the work series to display. Optional.
|
||||||
@params citeSeries URI for work series. Optional.
|
@params citeSeries URI for work series. Optional.
|
||||||
@params titleSeriesLang Language code of a foreign-language work series' title. Optional.
|
@params titleSeriesLang Language code of a foreign-language work series' title. Optional.
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
{{- .Scratch.Set "title" .Params.titleSeries -}}
|
{{- .Scratch.Set "title" .Params.titleSeries -}}
|
||||||
{{- .Scratch.Set "titleLang" .Params.titleSeriesLang -}}
|
{{- .Scratch.Set "titleLang" .Params.titleSeriesLang -}}
|
||||||
{{- .Scratch.Set "titleTr" .Params.titleSeriesTr -}}
|
{{- .Scratch.Set "titleTr" .Params.titleSeriesTr -}}
|
||||||
{{- .Scratch.Set "schemaType" .Params.schemaTypeSeries -}}
|
{{- .Scratch.Set "itemtype" .Params.itemtypeSeries -}}
|
||||||
{{- .Scratch.Set "href" .Params.hrefSeries -}}
|
{{- .Scratch.Set "href" .Params.hrefSeries -}}
|
||||||
{{- partial "cite.html" . -}}
|
{{- partial "cite.html" . -}}
|
||||||
{{- with .Params.numberSeries }}, {{ . | safeHTML -}}{{- end -}}
|
{{- with .Params.numberSeries }}, {{ . | safeHTML -}}{{- end -}}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
@params cite URI for work. Optional.
|
@params cite URI for work. Optional.
|
||||||
@params citeStyle Force a citation style. Optional.
|
@params citeStyle Force a citation style. Optional.
|
||||||
@params href URI for citation, or 'asCite' to use value of `cite`. Optional.
|
@params href URI for citation, or 'asCite' to use value of `cite`. Optional.
|
||||||
@params schemaType The Schema.org `itemtype` value. Default 'CreativeWork'.
|
@params itemtype The Schema.org `itemtype` value. Default 'CreativeWork'.
|
||||||
@params shortTitle Abbreviated display title. Optional.
|
@params shortTitle Abbreviated display title. Optional.
|
||||||
@params title Title of the work to display.
|
@params title Title of the work to display.
|
||||||
@params titleLang Language code of a foreign-language work's title. Optional.
|
@params titleLang Language code of a foreign-language work's title. Optional.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue