Hi,
I can’t understand what’s happening with my map object, which is a slice of maps, and at some point it seems to become nul, despite my test for emptiness. It seems to have the correct structure though !
The error happens at the very first iteration. The entire object has
this value:
[map[Destination:/glossaire/une-demarche-pionniere/ Hash:55d29d7b2126c04b46d2b4e3486552fa Page:Page(/glossaire/une-demarche-pionniere.md)] map[Destination:/glossaire/plus-quune-synthese/ Hash:c3d9da748479ee65c784e9145a10033c Page:Page(/glossaire/plus-quune-synthese.md)] map[Destination:/glossaire/connaissances-plus-recentes/ Hash:194a819467a720d5abd36549df96aa81 Page:Page(/glossaire/connaissances-plus-recentes.md)] map[Destination:/glossaire/ecopsychologie-evolutive-biologie/ Hash:a3e4c2f16d3c53707536e88e535f90dd Page:Page(/glossaire/ecopsychologie-evolutive-biologie.md)] map[Destination:/glossaire/ecopsychologie-evolutive-psychologie/ Hash:89bfb386d4a426a0b70a77ea747ccce2 Page:Page(/glossaire/ecopsychologie-evolutive-psychologie.md)] map[Destination:/glossaire/ecopsychologie-evolutive-parapsychologie/ Hash:8335ccf8ccc469801bbf843e3e125a25 Page:Page(/glossaire/ecopsychologie-evolutive-parapsychologie.md)] map[Destination:/glossaire/quen-est-il-sur-le-net/ Hash:e3f9981a261f6fa38cb8768dc6c93f28 Page:Page(/glossaire/quen-est-il-sur-le-net.md)] map[Destination:/glossaire/culture-et-occultation/ Hash:7ff52292b6d1b0ebecce8772b2f6e3ac Page:Page(/glossaire/culture-et-occultation.md)] map[Destination:/glossaire/environment/ Hash:9db880db2555873a7de4399c6bf348d1 Page:Page(/glossaire/environment.md)] map[Destination:/glossaire/paradigme/ Hash:a7b563e01c81efd82be045031d0b506b Page:Page(/glossaire/paradigme.md)] map[Destination:/glossaire/science-vie-quotidienne/ Hash:7e4a571e1e934b8538ad65b8f871af6d Page:Page(/glossaire/science-vie-quotidienne.md)] map[Destination:/glossaire/dimension-transcendante-de-lunivers/ Hash:176654801c282965c7865912f8f2b0fd Page:Page(/glossaire/dimension-transcendante-de-lunivers.md)] map[Destination:/glossaire/fonction-extrasensorielle-de-leros-oubliee-siecles/ Hash:714f5ad169b9fbd5fbbf678d2a2522a7 Page:Page(/glossaire/fonction-extrasensorielle-de-leros-oubliee-siecles.md)] map[Destination:/glossaire/modele-de-societe/ Hash:70f0c8c04a3a64737d2fc6ac2cb1ef15 Page:Page(/glossaire/modele-de-societe.md)] map[Destination:/glossaire/nouveau-modele-de-civilisation/ Hash:0690ba4fca38a869fd80a97faa2d017e Page:Page(/glossaire/nouveau-modele-de-civilisation.md)] map[Destination:/glossaire/constuire-votre-avenir/ Hash:cde40987e5ef361a2e43e5923a004df9 Page:Page(/glossaire/constuire-votre-avenir.md)]]
While the first element of the slice is:
map[Destination:/glossaire/une-demarche-pionniere/ Hash:55d29d7b2126c04b46d2b4e3486552fa Page:Page(/glossaire/une-demarche-pionniere.md)]
Yet calling {{ return (default .Params.Title .Params.linkTitle |.Page.RenderString) }}
(in a partial) with the field .page as context, fails, because it’s executing "partials/docs/title-menu.html" at <.Params.Title>: nil pointer evaluating interface {}.Params
I initialize the slice with this:
{{ .Scratch.Set “list-dialogs” (slice) }}
and populate it with
{{ .Page.Scratch.Add “list-dialogs” (dict “Page” $page “Destination” $destination “Hash” $hash )}}
and the loop is this one:
{{if ne (.Scratch.Get "list-dialogs") (slice) }}
{{ range (.Scratch.Get "list-dialogs") }}
{{ warnf "%v" .}}
<input type="checkbox" id="{{.hash}}"/>
<dialog open role=article>
<form method="dialog">
<span role=heading>{{partial "docs/title-menu.html" .page}}</span>
<button>X</button></form>
<iframe src="{{ print .destination "?iframe"}}" allowfullscreen allow-same-origin seamless></iframe>
</dialog>
{{ end }}
{{ end }}
With the partial being:
{{ return (default .Params.Title .Params.linkTitle |.Page.RenderString) }}