handlebars.js - Getting the page URL in a pages collection loop -


im trying build dynamic menu create list of pages per tag. working fine except don't know how page url populated:

<section class="see-also"> {{#each tags}}     <p>in <span class="tag">{{tag}}</span>:</p>     {{#each pages}}         <li><a href="#">{{data.title}}</a>{{pages.url}}</li>     {{/each}} {{/each}} </section> 

any suggestions?

@luis-martins should able use relative helper destination current page being rendered , destination current page in tags.pages collection generate relative url:

<section class="see-also"> {{#each tags}}     <p>in <span class="tag">{{tag}}</span>:</p>     {{#each pages}}         <li><a href="#">{{data.title}}</a>{{relative ../../page.dest dest}}</li>     {{/each}} {{/each}} </section> 

notice the destination of current page being rendered, have use parent syntax handlebars: ../../page.dest. dest property on current page item tags.pages collection.

hope helps.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -