Remove conditional assignment from Document URL

The conditional assignment was making results from `url` quite outdated, causing #2557.

This PR provides a fix for the issue as well as a test covering document permalinks.
Yeah, but when `url` is first called at the beginning of `read`, `data` is not yet set, so the URL ends up not taking into consideration the permalink at all.