{{- /* CraftForms embed partial for Hugo — for use inside templates/layouts. Usage in a template: {{ partial "craftform.html" (dict "key" "aHR0cHM6Ly9…abc123" "wpUrl" "https://forms.example.com") }} {{ partial "craftform.html" (dict "key" .Params.formKey "resourceId" .Params.catalogItem "ctx" .) }} Params (dict keys): key (required) embed key wpUrl (optional) WordPress base URL; falls back to site param params.craftforms.wpUrl resourceId (optional) catalog item id ctx (optional) the page context, used only for a clearer error message */ -}} {{- $key := .key -}} {{- $wpUrl := .wpUrl | default (index site.Params "craftforms" "wpUrl") -}} {{- $resourceId := .resourceId -}} {{- if not $key -}} {{- errorf "craftform partial: `key` is required" -}} {{- end -}} {{- if not $wpUrl -}} {{- errorf "craftform partial: pass `wpUrl` or set params.craftforms.wpUrl in config" -}} {{- end -}} {{- $base := strings.TrimRight "/" $wpUrl -}}