Refactor submenu system to work everywhere

This change ensures that submenus work correctly in article pages,
profile pages, and in the main header.