Fixed the bug of incorrect url format for generated pages and the call
to `dir` which leads to the problem of incorret url.