refactor caption link creation for upper directories