mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-20 02:16:40 +00:00
See https://discord.com/channels/722225264733716590/738924091511144489/1406144559188283494 See https://gohugo.io/templates/new-templatesystem-overview/
25 lines
1.3 KiB
HTML
25 lines
1.3 KiB
HTML
{{/* Workaround Hugo concurrency issues (e.g. not detecting Page.Store variables) */}}
|
|
{{/* Use cases: Page.Store use within shortcodes, blox, and backlinks. */}}
|
|
{{/* See https://discourse.gohugo.io/t/persisting-data-across-the-build-of-a-site/41114/6 */}}
|
|
{{- range $page := site.AllPages }}
|
|
{{- $noop := .Content }}
|
|
{{ if eq .Type "landing" }}
|
|
{{ range $index, $block := .Params.sections }}
|
|
{{/* Do not show sections intended only for the demo site. */}}
|
|
{{ if or (not $block.demo) ($block.demo | and (eq (os.Getenv "HUGO_BLOX_DEMO") "true")) }}
|
|
{{ $block_type := lower ($block.blox | default $block.block) | default "markdown" }}
|
|
{{ range $r := site.Data.blox_aliases.renames }}
|
|
{{ $block_type = cond (eq $block_type $r.old) $r.new $block_type }}
|
|
{{ end }}
|
|
{{ $widget_config_file := printf "blox/%s--CONFIG.html" $block_type }}
|
|
{{ if templates.Exists (printf "_partials/%s" $widget_config_file) }}
|
|
{{/* warnf "Loading blox config at %s" $widget_config_file */}}
|
|
{{ $hash_id := $block.id | default (printf "section-%s" (replace $block_type "." "-")) }}
|
|
{{ $widget_args := dict "wcPage" $page "wcBlock" $block "wcIdentifier" $hash_id }}
|
|
{{ partial $widget_config_file $widget_args }}
|
|
{{end}}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{- end -}}
|
|
{{- end -}}
|