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

Params lower case issue with .GetPage #5946

Closed
marcojakob opened this issue May 7, 2019 · 3 comments
Closed

Params lower case issue with .GetPage #5946

marcojakob opened this issue May 7, 2019 · 3 comments
Labels
Bug
Milestone

Comments

@marcojakob
Copy link

@marcojakob marcojakob commented May 7, 2019

For normal pages something like .Params.myParam works (it used to be an issue but got fixed in #2590 and #2630).

But for .Site.GetPage it does not work. This is how I use it - mostly with headless pages:

Markdown in "content/settings/general/index.md"

+++
headless = true
myParam = "some value"
+++

Template in "layouts/index.html"

{{ $settingsPage := .Site.GetPage "/settings/general" }}
{{ $settingsPage.Params.myParam }} 

The last line does not return any value while {{ $settingsPage.Params.myparam }} does return the correct value.

@bep

This comment has been minimized.

Copy link
Member

@bep bep commented Jul 24, 2019

I suspect this must be "something else", e.g. you're not getting the page you think you do, a conflicting session? Do you get any output with {{ $settingsPage.Params.myparam }}?

@stale

This comment has been minimized.

Copy link

@stale stale bot commented Nov 21, 2019

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Nov 21, 2019
@marcojakob marcojakob changed the title Params lower case issue in headless page Params lower case issue with .GetPage Nov 21, 2019
@stale stale bot removed the Stale label Nov 21, 2019
@marcojakob

This comment has been minimized.

Copy link
Author

@marcojakob marcojakob commented Nov 21, 2019

I've tested it with Hugo v0.59.1 and it is still an issuel.

Sorry, for not answering earlier. Somehow missed your question @bep:

I suspect this must be "something else", e.g. you're not getting the page you think you do, a conflicting session? Do you get any output with {{ $settingsPage.Params.myparam }}?

Yes, I'm getting the right page and I do get a result for {{ $settingsPage.Params.myparam }} but no result for {{ $settingsPage.Params.myParam }} (with capitalized "P").

The original issue was a bit misleading because it doesn't matter if it is headless or not (I changed that). It is a problem with .Site.GetPage.

@bep bep added the Bug label Nov 21, 2019
@bep bep added this to the v0.60 milestone Nov 21, 2019
@bep bep removed the NeedsUserFeedback label Nov 21, 2019
bep added a commit to bep/hugo that referenced this issue Nov 21, 2019
@bep bep closed this in cd07e6d Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.