I just removed line
title="<?php echo get_post_meta( $attachment->ID, $key, true ); ?>"
from this code, but the empty title appears again in _a_ tag.
Something is rewriting title in a tag, but I can’t get where is the code, that doing this.
P.S. I know that this is right part of code, because rel=”<?php echo $post->ID; ?>” works fine.