diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-06-02 07:59:50 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-06-02 09:04:00 +0200 |
commit | 5e5ce00d419c02190662afc7eea6fbdea4d3062f (patch) | |
tree | 893ea9ed63b8da9a30593d0f73cb53fe76a6cb16 /hugolib/menu_test.go | |
parent | a191b38ac80356ee67caa28f6038a957150ba68d (diff) |
Fix menuItem.URL when pageRef is not set
Fixes #11062
Diffstat (limited to 'hugolib/menu_test.go')
-rw-r--r-- | hugolib/menu_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/hugolib/menu_test.go b/hugolib/menu_test.go index 751608246..810b9fe20 100644 --- a/hugolib/menu_test.go +++ b/hugolib/menu_test.go @@ -621,3 +621,35 @@ Menu Item: 0: <span>Home</span>|/| `) } + +// Issue #11062 +func TestMenusSubDirInBaseURL(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +baseURL = "https://example.com/foo/" +title = "Hugo Menu Test" +[menus] +[[menus.main]] +name = "Posts" +url = "/posts" +weight = 1 +-- layouts/index.html -- +{{ range $i, $e := site.Menus.main }} +Menu Item: {{ $i }}|{{ .URL }}| +{{ end }} +` + + b := NewIntegrationTestBuilder( + IntegrationTestConfig{ + T: t, + TxtarString: files, + }, + ).Build() + + b.AssertFileContent("public/index.html", ` +Menu Item: 0|/foo/posts| +`) + +} |