mirror of
https://github.com/ISEAL-Community/iseal-core.git
synced 2024-11-25 16:18:19 +01:00
site/layouts: add cluster to partialCached key
When we cache the output of partials we get duplicate elements be- cause both ISEAL and FSC have "Scope", "Certificate", etc modules. We need to use the cluster as an extra key for the partial cache so these don't overlap. See: https://gohugo.io/functions/partialcached/
This commit is contained in:
parent
baa22a7afc
commit
1678ec077e
@ -33,12 +33,13 @@
|
||||
{{/* it in the range below. */}}
|
||||
{{ $context := . }}
|
||||
|
||||
{{ .Scratch.Set "cluster" "Fsc" }}
|
||||
{{ $cluster := "Fsc" }}
|
||||
{{ .Scratch.Set "cluster" $cluster }}
|
||||
{{ $modules := slice "Assurance" "Certificate" "Coverage" "Evaluation" "Form" "Scope" "Status" }}
|
||||
{{ range $modules }}
|
||||
{{ $module := . }}
|
||||
{{ $.Scratch.Set "module" $module }}
|
||||
{{ partialCached "module-elements.html" $context $module }}
|
||||
{{ partialCached "module-elements.html" $context $cluster $module }}
|
||||
{{ end }}
|
||||
|
||||
<h2 id="download">Download</h2>
|
||||
|
@ -90,32 +90,40 @@
|
||||
|
||||
<h3 id="cluster-global">Global Cluster</h3>
|
||||
|
||||
{{ .Scratch.Set "cluster" "Global" }}
|
||||
{{ $cluster := "Global" }}
|
||||
{{ .Scratch.Set "cluster" $cluster }}
|
||||
{{ $modules := slice "Coverage" "Form" "Provenance" "Scope" "Status" }}
|
||||
{{ range $modules }}
|
||||
{{ $module := . }}
|
||||
{{ $.Scratch.Set "module" $module }}
|
||||
{{ partialCached "module-elements.html" $context $module }}
|
||||
|
||||
{{/* Call the partial template to render the module's elements. */}}
|
||||
{{/* Note that we need to use the $cluster and the $module as */}}
|
||||
{{/* keys to the partial's cache so the cache is unique (so we */}}
|
||||
{{/* don't get FSC elements in the ISEAL layout). */}}
|
||||
{{ partialCached "module-elements.html" $context $cluster $module }}
|
||||
{{ end }}
|
||||
|
||||
<h3 id="cluster-certification">Certification Cluster</h3>
|
||||
|
||||
{{ .Scratch.Set "cluster" "Certification" }}
|
||||
{{ $cluster := "Certification" }}
|
||||
{{ .Scratch.Set "cluster" $cluster }}
|
||||
{{ $modules := slice "Certificate" "Certificate Holder, Owner or Certified organization" "Certified Resource or Site" "Certifying Body" }}
|
||||
{{ range $modules }}
|
||||
{{ $module := . }}
|
||||
{{ $.Scratch.Set "module" $module }}
|
||||
{{ partialCached "module-elements.html" $context $module }}
|
||||
{{ partialCached "module-elements.html" $context $cluster $module }}
|
||||
{{ end }}
|
||||
|
||||
<h3 id="cluster-impact">Impact Cluster</h3>
|
||||
|
||||
{{ .Scratch.Set "cluster" "Impact" }}
|
||||
{{ $cluster := "Impact" }}
|
||||
{{ .Scratch.Set "cluster" $cluster }}
|
||||
{{ $modules := slice "Evaluation" }}
|
||||
{{ range $modules }}
|
||||
{{ $module := . }}
|
||||
{{ $.Scratch.Set "module" $module }}
|
||||
{{ partialCached "module-elements.html" $context $module }}
|
||||
{{ partialCached "module-elements.html" $context $cluster $module }}
|
||||
{{ end }}
|
||||
|
||||
<h2 id="download">Download</h2>
|
||||
|
Loading…
Reference in New Issue
Block a user