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

The global var site does not work for mixed-case Params #5615

Closed
kaushalmodi opened this issue Jan 17, 2019 · 5 comments · Fixed by #5626
Closed

The global var site does not work for mixed-case Params #5615

kaushalmodi opened this issue Jan 17, 2019 · 5 comments · Fixed by #5626
Milestone

Comments

@kaushalmodi
Copy link
Contributor

The bug is as the title says.

Here's a minimum working example:

config.toml

baseURL = "http://example.org/"
languageCode = "en-us"
title = "global site var bug"
theme = "test-theme"

[Params]
  # recognized by Hugo
  mainSections = ["posts", "notes"]
  # my custom param
  feedSections = ["posts"]

index.html

{{ printf `site.Title = %#v <br>` site.Title | safeHTML }}
{{ printf `$.Site.Title = %#v <br><br>` $.Site.Title | safeHTML }}

{{ printf `site.Params.mainSections = %#v <br>` site.Params.mainSections | safeHTML }}
{{ printf `$.Site.Params.mainSections = %#v <br><br>` $.Site.Params.mainSections | safeHTML }}

{{ printf `site.Params.feedSections = %#v <br>` site.Params.feedSections | safeHTML }}
{{ printf `$.Site.Params.feedSections = %#v <br>` $.Site.Params.feedSections | safeHTML }}

Above prints:

site.Title = "global site var bug" 
$.Site.Title = "global site var bug" 

site.Params.mainSections = []interface {}{"posts", "notes"} 
$.Site.Params.mainSections = []interface {}{"posts", "notes"} 

site.Params.feedSections = 
$.Site.Params.feedSections = []interface {}{"posts"} 

Note that site.Params.feedSections doesn't return the expected value.

@kaushalmodi
Copy link
Contributor Author

Here's a repo with the above minimum workable example: https://gitlab.com/hugo-mwe/hugo-issue-5615/

  1. Clone the repo
  2. cd to the dir
  3. Run hugo

And you will get:

image

@bep bep changed the title The global var site does not work for custom site Params The global var site does not work for mixed-case Params Jan 18, 2019
@bep bep added the Bug label Jan 18, 2019
@bep bep added this to the v0.54 milestone Jan 18, 2019
@bep
Copy link
Member

bep commented Jan 18, 2019

A bug, alright, but I'm pretty sure that:

site.Params.mainsections

Would work.

@kaushalmodi
Copy link
Contributor Author

kaushalmodi commented Jan 18, 2019

A bug, alright, but I'm pretty sure that:

site.Params.mainsections

Would work.

site.Params.mainSections (internal param) already works.

Let me try site.Params.feedsections (custom param) ..

@kaushalmodi
Copy link
Contributor Author

I confirm that the mixed case is not supported only for the custom parameters:

image

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants