Refactor get the alert box to display on pages that aren't index