hugolib: Fix alias path for AMP and similar
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 30 Mar 2019 15:46:18 +0000 (16:46 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 30 Mar 2019 15:46:51 +0000 (16:46 +0100)
Fixes #5760

hugolib/alias_test.go
hugolib/site_render.go

index 684e35c9a2ceeff9fe2ffda7df7a6d90127f2389..f968caf2354e8f6eaeb1f5b4bfa078d609886a96 100644 (file)
@@ -80,7 +80,7 @@ func TestAliasMultipleOutputFormats(t *testing.T) {
 
        // the alias redirectors
        b.AssertFileContent("public/foo/bar/index.html", "<meta http-equiv=\"refresh\" content=\"0; ")
-       b.AssertFileContent("public/foo/bar/amp/index.html", "<meta http-equiv=\"refresh\" content=\"0; ")
+       b.AssertFileContent("public/amp/foo/bar/index.html", "<meta http-equiv=\"refresh\" content=\"0; ")
        assert.False(b.CheckExists("public/foo/bar/index.json"))
 }
 
index a6cf4bafaef7aff56790e5f151b317f0867c120f..c528e61a8001db760f8d4e549bd391a96c91205a 100644 (file)
@@ -305,7 +305,7 @@ func (s *Site) renderAliases() error {
                        for _, a := range p.Aliases() {
                                if f.Path != "" {
                                        // Make sure AMP and similar doesn't clash with regular aliases.
-                                       a = path.Join(a, f.Path)
+                                       a = path.Join(f.Path, a)
                                }
 
                                lang := p.Language().Lang