singaround / songbook

Songbook Static Site
MIT License
4 stars 7 forks source link

Improve implementation of index #7

Open singaround opened 5 years ago

singaround commented 5 years ago

The current way the index is done is slightly odd, setting two variables that the include relies on:

https://github.com/singaround/songbook/blob/0412acac8ed78e1914b480982646c6bca50fa7f8/pages/index.njk#L12-L14

This feels like it might be an ideal place for to use eleventy shortcodes https://www.11ty.io/docs/shortcodes/

The other option would be to set an indexKey property or similar when creating the collections: https://github.com/singaround/songbook/blob/0412acac8ed78e1914b480982646c6bca50fa7f8/.eleventy.js#L82-L85 (similar to the way we set songNumber when iterating over all songs).

This would at least skip the second magic variable.