Change $link to $ref

$ref is the last segment in v4.

work item: #1582