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;
|
||||
text-align: center;
|
||||
text-decoration: none !important;
|
||||
line-height: 1.8em;
|
||||
line-height: 1.2em;
|
||||
background-color: #ebebeb;
|
||||
padding-block: 0.25em;
|
||||
}
|
||||
|
||||
& hgroup {
|
||||
|
|
|
@ -7,8 +7,9 @@ resources:
|
|||
- name: lena
|
||||
src: images/lena.*
|
||||
params:
|
||||
alt: Woman smiling
|
||||
attr:
|
||||
alt: Well-known Standard Test Image "Lenna"
|
||||
attr: Playboy
|
||||
attrlink: https://en.wikipedia.org/wiki/File:Lenna_(test_image).png
|
||||
---
|
||||
|
||||
## HTML
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
style="width: 100%; height: 500px; margin: 0; display: block;"
|
||||
></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>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
@params cite URI for work. Optional.
|
||||
@params citeStyle Force a citation style. 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 title Title of the work to display.
|
||||
@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" -}}
|
||||
{{- $titleLang := default .Params.titleLang ( .Scratch.Get "titleLang" ) -}}
|
||||
{{- $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 "#" ) -}}
|
||||
{{- 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' -->
|
||||
|
||||
{{- if ( and $schemaType ( not ( in $.Site.Data.itemtypes $schemaType ) ) ) -}}
|
||||
{{- erroridf "invalid-schemaType" "Invalid Schema.org type value %q for %q" $schemaType $title -}}
|
||||
{{- if ( and $itemtype ( not ( in $.Site.Data.itemtypes $itemtype ) ) ) -}}
|
||||
{{- erroridf "invalid-itemtype" "Invalid Schema.org type value %q for %q" $itemtype $title -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- TODO: check `.Params.cite` is URI -->
|
||||
|
@ -48,7 +48,7 @@
|
|||
{{- end -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
{{- $itemType := default "CreativeWork" $schemaType -}}
|
||||
{{- $itemType := default "CreativeWork" $itemtype -}}
|
||||
{{- if ( or ( in $.Site.Data.itemtypes $itemType ) ( eq .Params.suppress "true" ) ) -}}
|
||||
{{- with .Params.href -}}
|
||||
<a href="{{- if eq . "asCite" -}}{{- $cite -}}{{- else -}}{{- . -}}{{- end -}}">
|
||||
|
|
|
@ -21,5 +21,5 @@
|
|||
{{- .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- else }}
|
||||
{{- .RelPermalink -}}
|
||||
{{- .img.RelPermalink -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -37,8 +37,13 @@
|
|||
class="article-header__featured-image"
|
||||
{{ with .pc.Params.featured_image }}
|
||||
{{ 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 }}
|
||||
{{- 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({{ . }})"
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
|
@ -50,7 +55,7 @@
|
|||
href="{{ .pc.Permalink }}"
|
||||
></a>
|
||||
{{- 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 -}}
|
||||
{{- partial "text/item-title.html" ( dict "pc" $.pc "sc" $.sc "class" "article-header" ) -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -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 -}}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
@see partials/cite.html for full list of args.
|
||||
|
||||
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 citeSeries URI for work series. Optional.
|
||||
@params titleSeriesLang Language code of a foreign-language work series' title. Optional.
|
||||
|
@ -86,7 +86,7 @@
|
|||
{{- .Scratch.Set "title" .Params.titleSeries -}}
|
||||
{{- .Scratch.Set "titleLang" .Params.titleSeriesLang -}}
|
||||
{{- .Scratch.Set "titleTr" .Params.titleSeriesTr -}}
|
||||
{{- .Scratch.Set "schemaType" .Params.schemaTypeSeries -}}
|
||||
{{- .Scratch.Set "itemtype" .Params.itemtypeSeries -}}
|
||||
{{- .Scratch.Set "href" .Params.hrefSeries -}}
|
||||
{{- partial "cite.html" . -}}
|
||||
{{- with .Params.numberSeries }}, {{ . | safeHTML -}}{{- end -}}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
@params cite URI for work. Optional.
|
||||
@params citeStyle Force a citation style. 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 title Title of the work to display.
|
||||
@params titleLang Language code of a foreign-language work's title. Optional.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue