I assume some obvious oversight here. Any tips would be greatly appreciated. Is the .GetPage
method available on the global site
object?
{{ else if $_page.IsSection }} <!-- section exception -->
{{ warnf " ##UTILS/get-resources :: branching on section page: %sassets/" $_page.File.Dir }}
{{ $assets := site.GetPage ( printf "%sassets/" $_page.File.Dir ) }}
{{ warnf " ##UTILS/get-resources :: working on: %v" $assets }}
{{ if $assets }}
{{ $return = $assets.Resources.Match ( printf "*%s*" $_resource ) }}
{{ else }}
{{ errorf "section %q needs a headless asset directory with resources at %sassets/." $_page.File.Path $_page.File.Dir }}
{{ end }}
corresponding error log:
DEBUG 2021/03/09 20:45:42 Render page assorted error pages to "/err/index.html"
WARN 2021/03/09 20:45:42 ##UTILS/get_resources digging in &{Page(/err/_index.md) nopPage HAHAHUGOSHORTCODE-TOC0-HBHB 0xc000b2ef60} @ 1615319142
WARN 2021/03/09 20:45:42 ##UTILS/get-resources :: branching on section page: err/assets/
WARN 2021/03/09 20:45:42 ##UTILS/get-resources :: working on: nopPage
ERROR 2021/03/09 20:45:42 section "err/_index.md" needs a headless asset directory with resources at err/assets/.
WARN 2021/03/09 20:45:42 ##UTILS/get_resources returning false @ 1615319142
the directory is set and has a headless frontmatter declaration.
Note that @ 1615319142
is a now.Unix
to force execution as sometimes warnings don’t always log.