small adjustments

pull/928/head
CrSjimo 2021-09-10 22:20:50 +08:00
parent 81fa904599
commit 33fd026148
1 changed files with 5 additions and 3 deletions

View File

@ -20,11 +20,13 @@ function formatWidgets(widgets) {
} }
function hasColumn(widgets, position, config, page) { function hasColumn(widgets, position, config, page) {
const showToc = (config.toc === true || page.toc) && ['page', 'post'].includes(page.layout); const showToc = (config.toc === true) && ['page', 'post'].includes(page.layout);
if (Array.isArray(widgets)) { if (Array.isArray(widgets)) {
return typeof widgets.find(widget => { return typeof widgets.find(widget => {
if(widget.type === 'toc' && !showToc)return false; if (widget.type === 'toc' && !showToc) {
return widget.position === position return false;
}
return widget.position === position;
}) !== 'undefined'; }) !== 'undefined';
} }
return false; return false;