add widgets middleware