feat(11ty): skip items which have skip flag set in toc

This commit is contained in:
Oscar 2019-11-17 19:49:22 +01:00
parent 6e087a9abe
commit 488a5cdafd

View File

@ -54,6 +54,7 @@ module.exports = function (config) {
config.addCollection('tableOfContent', collection => {
const allItems = collection
.getFilteredByGlob('./11ty/definitions/*.md')
.filter(word => !word.data.skip_in_table_of_content)
.sort((a, b) => {
// `localeCompare()` is super cool: http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare
return a.data.title.toLowerCase().localeCompare(b.data.title.toLowerCase())
@ -83,7 +84,7 @@ module.exports = function (config) {
}
allItems.forEach(word => {
const { title } = word.data
const { title, skip_in_table_of_content } = word.data
const { notLetters, aToE, fToL, mToS, tToZ } = split
if (/^[a-e]/gmi.test(title)) {