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

Adapter content is not creating related pages by keywords #13443

Closed
bbaulenas opened this issue Feb 24, 2025 · 3 comments · Fixed by #13447
Closed

Adapter content is not creating related pages by keywords #13443

bbaulenas opened this issue Feb 24, 2025 · 3 comments · Fixed by #13447
Assignees
Labels
Milestone

Comments

@bbaulenas
Copy link

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

hugo v0.141.0-e7bd51698e5c3778a86003018702b1a7dcb9559a+extended linux/amd64 BuildDate=2025-01-16T13:11:18Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

I don't know


👋 First of all I must say that I LOVE hugo, thanks for this amazing project.

Let's get to the point, recently I have migrated my hugo to content adapters and I found that when using a content adapter the related pages are not created by keywords anymore.

If I copy keywords to params.tags it works again.

I'm using hugo default configuration for related content.

I create a page with this:

{{ $page := dict
    "kind" "page"
    "title" $post.title
    "dates" $dates
    "keywords" "one"
    "content" $content
    "path" $postPath
}}

As keywords create related content in markdown I suppose that this is a bug.

@bep
Copy link
Member

bep commented Feb 24, 2025

"keywords" "one"

I'm not saying this is what happens, but keywords is a slice, so "keywords" (slice "one") would be something to try.

You could verify by just printing the Page keywords in a template, e.g. {{ .Keywords }}

@bep bep added this to the v0.145.0 milestone Feb 24, 2025
@jmooring
Copy link
Member

Assuming this front matter: keywords = ['a','b','c']

With pages created manually:

{{ .Keywords }} →        [a b c]
{{ .Params.keywords }} → [a b c]
{{ .Params.Keywords }} → [a b c]

With pages created by a content adapter:

{{ .Keywords }} →        [a b c]
{{ .Params.keywords }} → 
{{ .Params.Keywords }} → 

The related pages config should be keying off of "Keywords" (capitalized), but either "Keywords" or "keywords" works with pages created manually.

[[related.indices]]
name = 'Keywords'
weight = 80

Perhaps we lowercase the index name internally? Because if I change the content adapter to do this...

"params" (dict "keywords" (slice "a" "b" "c"))

... the related pages feature works as expected.

@bep bep self-assigned this Feb 24, 2025
@bep
Copy link
Member

bep commented Feb 24, 2025

OK, there's obviously a bug or two here ... I'll have a closer look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants