Files
FixIt/layouts/_partials/init/compatibility.html
T
Cell 5322a15ceb docs(layouts): add header comments to undocumented partials
Add `{{/* ... */}}` header comments to 25 partials that had no documentation,
enabling `pnpm gen:docs` to generate their reference docs. Also fix
base/head/index.html leading blank line that prevented parser matching.

Groups covered: base/, feed/, function/, home/, init/, plugin/, single/, store/, (root).
2026-07-23 12:56:40 +08:00

30 lines
1.1 KiB
HTML

{{- /*
Browser compatibility polyfills partial.
Conditionally loads polyfill.io and object-fit-images for older browsers
based on site compatibility configuration.
*/ -}}
{{- $compatibility := .Site.Params.compatibility | default dict -}}
{{- $cdn := .Site.Store.Get "cdn" | default dict -}}
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
{{- /* Polyfill.io */ -}}
{{- if $compatibility.polyfill -}}
{{- $features := slice -}}
{{- range resources.Get "data/polyfill.yml" | transform.Unmarshal -}}
{{- range . -}}
{{- $features = $features | append . -}}
{{- end -}}
{{- end -}}
{{- with $features | uniq -}}
{{- delimit . "%2C" | printf "https://cdnjs.cloudflare.com/polyfill/v3/polyfill.js?features=%v" | dict "Source" | dict "Page" $ "Data" | partial "store/script.html" -}}
{{- end -}}
{{- end -}}
{{- /* object-fit-images */ -}}
{{- if $compatibility.object_fit -}}
{{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}}