-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Consider empty strings in Param() as "not found" #3366
Comments
My initial reaction is to leave What's the expected behavior in Bud's case? Why can't we use |
I was under the impression that it's sort of the equivalent of the following from the docs:
|
@rdwatters is correct; his construction would work with less confusion in this case, but then again, having empty params scattered around seems like a messy ... mess, too, so. |
It's true that the default only works when the field is gone completely, but it's inevitable that those empty params are going to be there when using an archetype. |
It's not inevitable. You could just ... delete it, but I get your point. @fj may have some weight on this, as he reworked these methods some time ago. |
Not to be argumentative, but the way I set up my sites (and the way I think others will be too in many cases) is to set up archetypes to be clues to an editor like forestry.io as to what fields to show in their interface. So, having those "fields" there, empty or no, is important. Every page needs to have a consistent set of fields whether or not any given field is being used. |
Agreed. I find I always put the empty string for the value since the generator, if my memory serves, will otherwise insert |
A cleaner solution may be to not put empty strings into the params map when we read the front matter. |
How crazy does it sound to beef up the For example, allowing just a |
@bep, if we don't put the keys in the map, will Having empty strings in the Params map is fine with me. Can we detect the difference between |
@moorereason Yes. I just tested that and it works. |
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. |
@bep, I think we can close this issue. The solution is to use
instead of
In that case, the |
Not sure how that applies to this particular issue? |
I would like to close this issue. The To ignore falsy values, use this construct instead:
I recently updated https://gohugo.io/functions/param/, including the example above. |
No, the |
I'm not sure where the disagreement is. Please let me know if the updated documentation is incorrect: |
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. |
I'm not totally sure about this, but @budparr has a theme where he in front matter (for archetype reasons) have:
And when doing
You will not get the desired effect of getting the image defined in site config. May be something to think about, but we should maybe fix archetypes to allow comments. Keep this as a reminder for a while ...
The text was updated successfully, but these errors were encountered: