% function layoutToc() { if (toc(page.content).length > 0) { return toc(page.content, { list_number: item.list_number, min_depth: item.min_depth, max_depth: item.max_depth }); } } function layoutDiv(fallback) { var t = ''; if (page.layout == 'post' && page.content) { let toc_content = toc(page.content); if (toc_content && toc_content.length > 0) { t = page.layout; } } else if (page.layout == 'wiki') { t = page.layout; } else if (page.sidebar.includes('toc') == true) { t = page.layout; } var el = ''; if (t.length > 0) { el += '
'; return el; } else if (item.fallback) { return fallback(item.fallback); } } %> <%- layoutDiv(function(widget){ return partial(widget, {item: theme.sidebar.widgets[widget]}) }) %>