Menu icon Foundation
Is Panini #ifequal can evaluate object 'this'?

Hi,

I worked with the ZURB template of Foundation for sites.

I really don't see what is the problem, I have this partial :

            {{#each @root.content}}
              {{#ifequal @key @../key}}
                  {{@key}}-{{this}} this output the right key and string import-fragment as I supposed
                {{#ifequal this 'import-fragment'}} but not able to make it equal true?
                  {{@key}}-{{this}} not able to enter here and call this partial
                  {{> fragment-router sub-segment-obj=../this }}
                {{else}}
                  but all works well here
                  {{> main-content sub-segment-obj=../this }}
                {{/ifequal}}
              {{/ifequal}}
            {{/each}}

as you can read in the code, I'm not able to reach the condition {{#ifequal this 'import-fragment'}} even if it's the right string that is evaluated. This is the page where I put content in Front Matter YAML format :

---
category: marketing

content:
###################################### SECTION ########################################## 
  
  web-stats: import-fragment # why this doesn't equal import-fragment???

# all following this works
  web-stats-in-page-way:
    sub-sections:

################### ARTICLE #######################      
      
      First article:
...

Is someone can see what I missed?

All comments (not commented with curly braces) are just for the purpose but I tested without of course.

Thank you in advance.

paniniHandlebarsYAML

Hi,

I worked with the ZURB template of Foundation for sites.

I really don't see what is the problem, I have this partial :

            {{#each @root.content}}
              {{#ifequal @key @../key}}
                  {{@key}}-{{this}} this output the right key and string import-fragment as I supposed
                {{#ifequal this 'import-fragment'}} but not able to make it equal true?
                  {{@key}}-{{this}} not able to enter here and call this partial
                  {{> fragment-router sub-segment-obj=../this }}
                {{else}}
                  but all works well here
                  {{> main-content sub-segment-obj=../this }}
                {{/ifequal}}
              {{/ifequal}}
            {{/each}}

as you can read in the code, I'm not able to reach the condition {{#ifequal this 'import-fragment'}} even if it's the right string that is evaluated. This is the page where I put content in Front Matter YAML format :

---
category: marketing

content:
###################################### SECTION ########################################## 
  
  web-stats: import-fragment # why this doesn't equal import-fragment???

# all following this works
  web-stats-in-page-way:
    sub-sections:

################### ARTICLE #######################      
      
      First article:
...

Is someone can see what I missed?

All comments (not commented with curly braces) are just for the purpose but I tested without of course.

Thank you in advance.

Rafi Benkual about 1 year ago

panini ifEqual does a shallow javascript '===', so it will probably not work as expected on anything deep (e.g. objects). 

However you could write their own helper

Jatin popli 6 months ago

Township cannot be the unequal thing and and if their is inequality then you should be loosing the game as well. Township hacks is the place where you will know about the game and then refer it to the given article.