Add a directive for making it possible to search when switching pages