All,
I’m stumped. I am trying to do something ‘interesting’ with tag.hbs. I have posts with a primary tag (i.e. red, blue, green) and a variety of additional tags (i.e. cat, dog, pig). When I visit /tag/red, I want to the following to happen:
Show a group of posts with the tag cat AND the red tag
Show a group of posts with the tag dog AND the red tag
…etc.
Here’s what I have:
{{#tag}}
<header >
{{ name }}, {{slug}}
</header>
slug is {{slug}}
{{#get 'tags' filter='slug:[cat,dog,pig]'}}
{{#foreach tags}}
<p>inside {{../../slug}}, {{slug}}
{{#get 'posts' filter='tags:{{slug}}+primary_tag:{{../../slug}}' include='tags,authors' limit=@custom.number_of_posts_for_tags_home_sections as |posts|}}
{{/get}}
{{/foreach}}
{{/get}}
{{/tag}}
The ‘inside’ line works fine - I get the outer slug as expected.
The innermost #get does not work. It causes handlebars to write out: “IncorrectUsageError: We detected a misuse. Please read the stack trace.” The problem is specifically the primary_tag part of the filter. If I remove the {{../../slug}}
, everything works fine, except then I’m not getting only the posts I want.
I also tried using {{#contentFor}} and {{block }} to pass in the name of the ‘red’ slug. Didn’t work. And I tried calling the partial with a parameter, which worked OK if I hard coded it, but I couldn’t seem to pass in the variable value that way either.
Open to any suggestions! Help??
The error message in the logs is:
"name":"IncorrectUsageError","statusCode":400,"level":"critical","message":"We detected a misuse. Please read the stack trace.","context":"\"registerAsyncThemeHelper: get\"","stack":"Error: Parse error on line 1:\n at Object.returnAsync (D:\\Programming\\client sites\\citymyway\\versions\\5.26.3\\core\\frontend\\services\\helpers\\handlebars.js:19:75)\n../../slug\n^\nExpecting 'DOLLAR', 'STAR', 'IDENTIFIER', 'SCRIPT_EXPRESSION', 'INTEGER', 'END', got 'DOT_DOT'\n at Parser.parseError (D:\\Programming\\client sites\\citymyway\\versions\\5.26.3\\node_modules\\jsonpath\\generated\\parser.js:166:15)\n at Parser.parser.yy.parseError (D:\\Programming\\client sites\\citymyway\\versions\\5.26.3\\node_modules\\jsonpath\\lib\\parser.js:13:17)\n at Parser.parse (D:\\Programming\\client sites\\citymyway\\versions\\5.26.3\\node_modules\\jsonpath\\generated\\parser.js:224:22)\n at JSONPath.nodes (D:\\Programming\\client sites\\citymyway\\versions\\5.26.3\\node_modules\\jsonpath\\lib\\index.js:118:26)\n at JSONPath.query (D:\\Programming\\client sites\\citymyway\\versions\\5.26.3\\node_modules\\jsonpath\\lib\\index.js:94:22)\n at D:\\Programming\\client sites\\citymyway\\versions\\5.26.3\\core\\frontend\\helpers\\get.js:84:31\n