unite the code to list pages and search