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

feat: move author field to languages.xx.toml under params #704

Merged
merged 5 commits into from
Nov 27, 2023

Conversation

Jh123x
Copy link
Contributor

@Jh123x Jh123x commented Nov 12, 2023

First time contributing so please do let me know if I am doing something wrong.

  • feat: move author field to params.toml
  • feat: add warning when author field is in languages.xx.toml instead of params.toml
  • docs: update docs to reflect change

Closes #690

Copy link

netlify bot commented Nov 12, 2023

Deploy Preview for hugo-congo ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a15820c
🔍 Latest deploy log https://app.netlify.com/sites/hugo-congo/deploys/65635e1d02b5f800083a3b1c
😎 Deploy Preview https://deploy-preview-704--hugo-congo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Jh123x
Copy link
Contributor Author

Jh123x commented Nov 12, 2023

Not sure how to change the docs correctly.
Do I need to change them for every translation?

For snippets like this in getting-started

# config/_default/languages.en.toml

title = "My awesome website"

[author]
name = "My name"
image = "img/author.jpg"
headline = "A generally awesome human"
bio = "A little bit about me"
links = [
  { twitter = "https://twitter.com/username" }
]

So I just make another snippet that points is something like

# config/_default/languages.en.toml

title = "My awesome website"
# config/_default/params.toml

[author]
name = "My name"
image = "img/author.jpg"
headline = "A generally awesome human"
bio = "A little bit about me"
links = [
  { twitter = "https://twitter.com/username" }
]

@jpanther
Copy link
Owner

I think this is on the right track, but I don't think moving the author params to params.toml is the correct solution as it will be difficult to localise. I have a feeling these need to move under the [params] block in the respective languages.[lang].toml file.

ie. we end up with:

[params.author]
name = "Name"

I haven't tackled this one yet as it's a bit of breaking change for users to migrate these values and so it needs a minor version bump. It might be valuable to test some fallback scenarios to determine if it can handle using both the values in the correct location and the old location. I also think this change could be bundled into a wider feature that implements multi-author functionality.

@Jh123x Jh123x changed the title feat: move author field to params.toml feat: move author field to languages.xx.toml under params Nov 25, 2023
@Jh123x
Copy link
Contributor Author

Jh123x commented Nov 25, 2023

I think this is on the right track, but I don't think moving the author params to params.toml is the correct solution as it will be difficult to localise. I have a feeling these need to move under the [params] block in the respective languages.[lang].toml file.

ie. we end up with:

[params.author]
name = "Name"

I haven't tackled this one yet as it's a bit of breaking change for users to migrate these values and so it needs a minor version bump. It might be valuable to test some fallback scenarios to determine if it can handle using both the values in the correct location and the old location. I also think this change could be bundled into a wider feature that implements multi-author functionality.

Updated! Is the current implementation ok?

@jpanther
Copy link
Owner

That's much better, I think the only thing left to tweak is the warning message. It's directing people to the params.toml file when really it should just say that the author block needs to be changed to params.author in languages.xx.toml.

@jpanther jpanther added the bug Something isn't working label Nov 25, 2023
@jpanther
Copy link
Owner

Thanks, looks good. I'll merge it in later today.

@jpanther jpanther merged commit 1dcd318 into jpanther:dev Nov 27, 2023
6 checks passed
@Jh123x Jh123x deleted the fix/690/hugo-v0.120.0-author-key-update branch November 27, 2023 14:41
@kelset
Copy link
Contributor

kelset commented Jan 17, 2024

hey @jpanther - thanks for maintaining this great theme! QQ: am I wrong or this fix hasn't made it yet in a released version? Sorry, I'm not sure familar with the whole Go ecosystem

@Jh123x
Copy link
Contributor Author

Jh123x commented Jan 17, 2024

hey @jpanther - thanks for maintaining this great theme! QQ: am I wrong or this fix hasn't made it yet in a released version? Sorry, I'm not sure familar with the whole Go ecosystem

I think it is just in dev and not in a release yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hugo v0.120.0 deprecates the author key in site configuration
3 participants