diff options
author | Phil Pennock <pdp@spodhuis.org> | 2013-11-18 04:35:56 -0500 |
---|---|---|
committer | Noah Campbell <noahcampbell@gmail.com> | 2013-11-18 13:32:56 -0800 |
commit | 07978e4a4922bc21c230fee65052232b829bd1ab (patch) | |
tree | 02ec2b8a301becbea7660ff8dfbadc528737e75c /hugolib/config.go | |
parent | 4f335f0c7f83daa32906e8e40c7ac225efa113de (diff) |
configurable permalinks support
A sample config.yaml for a site might contain:
```yaml
permalinks:
post: /:year/:month/:title/
```
Then, any article in the `post` section, will have the canonical URL
formed via the permalink specification given.
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
Diffstat (limited to 'hugolib/config.go')
-rw-r--r-- | hugolib/config.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/hugolib/config.go b/hugolib/config.go index b9b5d54bd..9a737d7b7 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -34,6 +34,7 @@ type Config struct { Indexes map[string]string // singular, plural ProcessFilters map[string][]string Params map[string]interface{} + Permalinks PermalinkOverrides BuildDrafts, UglyUrls, Verbose bool } @@ -70,6 +71,11 @@ func SetupConfig(cfgfile *string, path *string) *Config { c.Indexes["category"] = "categories" } + // ensure map exists, albeit empty + if c.Permalinks == nil { + c.Permalinks = make(PermalinkOverrides, 0) + } + if !strings.HasSuffix(c.BaseUrl, "/") { c.BaseUrl = c.BaseUrl + "/" } |