this should pay attention to the dictionary page as well if there is one.
There is some code about this somewhere else, this logic should be centralized.