Remove debugging code
Fixes #598

Ensure we don’t generate permalinks with a target that is not in the
current story