Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content adapters clip path after last dot #12493

Closed
marchof opened this issue May 14, 2024 · 5 comments
Closed

Content adapters clip path after last dot #12493

marchof opened this issue May 14, 2024 · 5 comments
Assignees
Milestone

Comments

@marchof
Copy link

marchof commented May 14, 2024

What version of Hugo are you using (hugo version)?

hugo v0.126.0+extended darwin/arm64 BuildDate=2024-05-14T13:24:11Z VendorInfo=brew

Does this issue reproduce with the latest release?

Yes

Description

First of all, many thanks for providing content adapters with the latest release! This is a great addition for data driven sites like https://javaalmanac.io/

I started replacing generated markdown files with content adapters. Some of the paths contains dots, for example:

https://javaalmanac.io/jdk/6/apidiff/1.4/

Now I started dynamically creating these pages, using for example a path of jdk/6/apidiff/1.4/ to generate the page above.

Expected behavior

The content is created at jdk/6/apidiff/1.4/index.html

Actual Behaviour

The content is created at jdk/6/apidiff/1/index.html

So for me it looks like the path is clipped at the last dot (.). I tried with different paths like aaa/bbb.ccc/ which is also clipped to aaa/bbb.

@jmooring
Copy link
Member

Test case:

func TestFoo(t *testing.T) {
	t.Parallel()

	files := `
-- hugo.toml --
disableKinds = ['home','section','rss','sitemap','taxonomy','term']
-- content/_content.gotmpl --
{{ .AddPage (dict "path" "s-1.2.3/p-4.5.6" "title" "p-4.5.6") }}
-- layouts/_default/single.html --
{{ .Title }}
`

	b := hugolib.Test(t, files)

	b.AssertFileExists("public/s-1.2.3/p-4.5.6/index.html", true)
}

@jmooring
Copy link
Member

@marchof You can work around this by setting slug in the map passed to the AddPage method.

@marchof
Copy link
Author

marchof commented May 15, 2024

@jmooring Thanks for the quick response and the hint! Just for my understanding: Is the 0.126.0 behavior "works as designed" or will this be changed to render the full path?

@bep bep self-assigned this May 15, 2024
@bep bep removed the NeedsTriage label May 15, 2024
@bep
Copy link
Member

bep commented May 15, 2024

this be changed to render the full path?

This is marked as a bug, so it will be fixed.

@bep bep added this to the v0.126.1 milestone May 15, 2024
bep added a commit to bep/hugo that referenced this issue May 15, 2024
@bep bep closed this as completed in 1aacfce May 15, 2024
@marchof
Copy link
Author

marchof commented May 15, 2024

@bep @jmooring Thanks for this super-fast fix!

marchof added a commit to marchof/java-almanac that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants