diff --git a/hugolib/alias.go b/hugolib/alias.go index 7120e6086..d5eb35777 100644 --- a/hugolib/alias.go +++ b/hugolib/alias.go @@ -88,18 +88,6 @@ func (s *Site) publishDestAlias(allowRoot bool, path, permalink string, p *Page) isXHTML := strings.HasSuffix(path, ".xhtml") - if s.Info.relativeURLs { - // convert `permalink` into URI relative to location of `path` - baseURL := helpers.SanitizeURLKeepTrailingSlash(s.Cfg.GetString("baseURL")) - if strings.HasPrefix(permalink, baseURL) { - permalink = "/" + strings.TrimPrefix(permalink, baseURL) - } - permalink, err = helpers.GetRelativePath(permalink, path) - if err != nil { - s.Log.ERROR.Println("Failed to make a RelativeURL alias:", path, "redirecting to", permalink) - } - permalink = filepath.ToSlash(permalink) - } s.Log.DEBUG.Println("creating alias:", path, "redirecting to", permalink) targetPath, err := handler.targetPathAlias(path) diff --git a/hugolib/alias_test.go b/hugolib/alias_test.go index f5e6d8d1f..68ec8f07f 100644 --- a/hugolib/alias_test.go +++ b/hugolib/alias_test.go @@ -29,6 +29,14 @@ aliases: ["foo/bar/"] For some moments the old man did not reply. He stood with bowed head, buried in deep thought. But at last he spoke. ` +const pageWithAliasMultipleOutputs = `--- +title: Has Alias for HTML and AMP +aliases: ["foo/bar/"] +outputs: ["HTML", "AMP", "JSON"] +--- +For some moments the old man did not reply. He stood with bowed head, buried in deep thought. But at last he spoke. +` + const basicTemplate = "{{.Content}}" const aliasTemplate = "ALIASTEMPLATE" @@ -51,6 +59,32 @@ func TestAlias(t *testing.T) { th.assertFileContent(filepath.Join("public", "foo", "bar", "index.html"), "