Make permalink parsing consistent with pages

Reimplements #2921. It's a breaking change so punting until 3.0.

/cc @alfredxing