refactor templates layout
@see https://gohugo.io/templates/new-templatesystem-overview/
This commit is contained in:
parent
a83f339dc8
commit
230c46411b
102 changed files with 2 additions and 2 deletions
38
layouts/_shortcodes/chart.html
Normal file
38
layouts/_shortcodes/chart.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
{{- if ( not ( .Get "longdesc" ) ) -}}
|
||||
{{- erroridf "a11y-chart-longdesc" "No longdesc found for chart '%q' (%q)" ( .Get "chart-id" ) .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<figure
|
||||
class="article__figure figure figure--chart{{ with .Get "class" }}{{ . }}{{ end }}"
|
||||
role="group"
|
||||
>
|
||||
{{- with .Get "chart-id" -}}
|
||||
<div class="chart-container">
|
||||
<canvas
|
||||
width="auto"
|
||||
class="chart"
|
||||
id="{{ . }}"
|
||||
>
|
||||
You must enable Javascript to view this chart.
|
||||
</canvas>
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- with .Get "chart-id-2" -}}
|
||||
<div class="chart-container">
|
||||
<canvas
|
||||
class="chart"
|
||||
id="{{ . }}"
|
||||
>
|
||||
You must enable Javascript to view this chart.
|
||||
</canvas>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- if or ( .Get "caption" ) ( .Get "title" ) -}}
|
||||
<figcaption class="figure__caption{{ if not ( or ( .Get "caption" ) ( .Get "title" ) ) }}figure__caption--no-height{{ end }}">
|
||||
{{- with .Get "title" -}}<h4 class="figcaption__title">{{ . | markdownify | safeHTML }}</h4>{{- end -}}
|
||||
{{- with .Get "caption" -}}<p class="figcaption__caption">{{ . | $.Page.RenderString }}</p>{{- end -}}
|
||||
</figcaption>
|
||||
{{- end -}}
|
||||
</figure>
|
Loading…
Add table
Add a link
Reference in a new issue