FIX: handle permalinks with query parameters (PR #12700)

GitHub