better logic for post navigation