Fixing the current page's URL

the_permalink() was working fine with single posts and pages, but for
lists was showing the first post's URL, which was incorrect.

Split the decision to single and non single, and for the latter ones
producing a custom URL.