fix for written files to respect permalink in _config.yml

I made a fix for an issue where the generated folders under _site were not respecting the configured permalink in _config.yml.

Given this example config:

```
permalink: /blog/:year/:month/:day/:title
pretzel: 
    engine: liquid
```

Under _site, no /blog folder was being created, and the .html extension was not being removed from files. The post-level permalink was working fine, but the _config.yml permalink wasn't being used.

I added a few tests for PageContext that cover this fix.