Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve implementation of index #7

Open
singaround opened this issue Mar 9, 2019 · 0 comments
Open

Improve implementation of index #7

singaround opened this issue Mar 9, 2019 · 0 comments

Comments

@singaround
Copy link
Owner

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

songbook/pages/index.njk

Lines 12 to 14 in 0412aca

{% set indexlist = collections.songsByFirstline %}
{% set indexItem = "songLine" %}
{% include "components/indexlist.njk" %}

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:

songbook/.eleventy.js

Lines 82 to 85 in 0412aca

return item.data.chorusLine != null;
}).sort(function (a,b) {
return a.data.chorusLine.localeCompare(b.data.chorusLine)
});

(similar to the way we set songNumber when iterating over all songs).

This would at least skip the second magic variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant