When a grouped database contains many categories or items, having all groups expanded by default can make the page feel overwhelming for visitors.
While collapsing database groups by default is not currently a built-in feature in Super, you can achieve a similar result using the workaround below.
Note: Custom code is available on paid Super plans. An active subscription is required to use this workaround.
How to Set It Up
In your Super dashboard, go to Code → Body.
Paste the following JavaScript snippet into the Body code section.
Save your changes and refresh your site.
This script automatically collapses grouped database sections when the page loads, allowing visitors to expand only the categories they want to view.
<script>
function collapseGroups() {
document.querySelectorAll('.notion-collection-group__section-toggle').forEach(toggle => {
if (!toggle.dataset.collapsed) {
toggle.click();
toggle.dataset.collapsed = 'true';
}
});
}
const observer = new MutationObserver(() => {
collapseGroups();
});
observer.observe(document.body, {
childList: true,
subtree: true
});
collapseGroups();
</script>
