Add logic to handle sub pages.