{{/* FIXME: hot reload doesn't work on widgets children, need to change this page to get modification built */}} {{- /* Shortcode "widgets" */ -}} {{- /* Usage: {{< widgets >}} or {{< widgets 1 >}} {{< widgets 2 >}} */ -}} {{- /* Displays content of headless pages within the same folder, */ -}} {{- /* files starting with "_" or "_#1_", "_#2_", "_#intro_", etc. */ -}} {{- /* Retrieve widgets within the folder where this shortcode page lives. */ -}} {{- /* Widgets are headless pages starting with: */ -}} {{- /* - "_" (no zone specified) */ -}} {{- /* or */ -}} {{- /* - "_#x_" x=1, 2, intro... (specific named or numbered zone in page) */ -}} {{- $widget_pattern := "_" -}} {{- $widgets_type := "" -}} {{- $widgets_zone := "" -}} {{- $container_class := "" -}} {{- if .IsNamedParams -}} {{- $widgets_zone = .Get "zone" -}} {{- $widgets_type = .Get "type" -}} {{- else -}} {{- $widgets_zone = .Get 0 -}} {{- end -}} {{- if $widgets_zone -}} {{- $widget_pattern = print $widget_pattern "#" $widgets_zone "_" -}} {{- else -}} {{- $widget_pattern = print $widget_pattern "[!#]" -}} {{- end -}} {{- $widget_pattern = print $widget_pattern "*" -}} {{- /* @TODO: complete here for future widgets containers types */ -}} {{- if (eq $widgets_type "info-container") -}} {{- $container_class = "info-container wrapper" -}} {{- else if (eq $widgets_type "...") -}} {{- $container_class = "..." -}} {{- else -}} {{- $container_class = "stack-l --s2" -}} {{- end -}} {{- $page := $.Page -}} {{- $widgets_folder_path := $page.File.Path -}} {{- if eq $page.File.Dir "/" -}} {{- $widgets_folder_path = print "_home_widgets/" $widgets_folder_path -}} {{- end -}} {{- $resources := ($page.GetPage $widgets_folder_path).Resources -}}