mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
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>
This commit is contained in:
committed by
Noah Campbell
parent
4f335f0c7f
commit
07978e4a49
@@ -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 + "/"
|
||||
}
|
||||
|
Reference in New Issue
Block a user