Keeping order from frontmatter, not config

Just been thinking about something different, as with your approach causing me some hiccups.

By using sort I got this:

 {{ range sort (where $allTools "identifier" "in" .) "identifier" }}

will sort alphabetically by identifier.

It would be nice if I could sort by $frontmatterIds but somehow is not working.

ref: Sort a range by custom param - #4 by zwbetz

Looking at this:

This shall theoretically work:

{{ range sort (where $allTools "identifier" "in" .) "Params.amazon"}} 

but getting error calling sort: can't evaluate an invalid value

or

{{ range sort (where $allTools "identifier" "in" .) $frontmatterIds "asc" }}

no error, but not sorting correctly.