-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Use "method" instead of "variable" for methods #2196
Comments
So, it's still very much on my TODO list to get an auto generated reference section happening in Hugo. The recent config consolidation was a important part of this, and then I may have gotten distracted. With that setup you would get this "Reference":
While it's technically correct to say that Hugo's template functions are methods, they (mostly) behave like a function, and none of them have a "." context that the user needs to worry about, and I think the distinction between function and method is something that we need to preserve. So with that, I would not spend |
I agree, and that is consistent with the glossary of terms. What I am asking is, can we stop referring to things like |
Why not call them "properties"? That doesn't imply mutability (I think), but still permits to discern those from functions like |
They are not properties. They are methods. For example:
|
Well, if they are methods… I doubt that kind of terminology helps clarify things, though. A getter like If you replace (most) "variable" by "method" the intro to
I do not think that that makes any sense, at all. The current wording is a lot less complex and easier to understand. Even if it might not be technically correct. |
- Refer to page methods instead of page variables - Rework 404 template page - Remove table of contents page in favor of /methods/page/tableofcontents Improves gohugoio#2196
Improves gohugoio#2196
Closes gohugoio#2252 Improves gohugoio#2196
Closes gohugoio#2388 Improves gohugoio#2196
- Remove erroneous statements - Document use of global, page, and remote resources - Explain that data can be used to both augment and create content - Simplify examples Improves gohugoio#2196
Recently, I spent a significant amount of time attempting to define the "language of Hugo" while creating a glossary of terms. This was a challenging exercise, as I had to reconcile current usage with terms that are specific and (mostly) narrowly defined. This is comparable to, but much less time-consuming than, writing the Go language specification ten years after the language was first released.
Although our language choices have, for the most part, been logical and consistent, I think it's time to use the term "method" instead of "variable", with the exception of variables initialized within template actions (e.g.,
{{ $myVar := 42 }}
).Justification:
.Page.Title
and.Page.IsSection
variables, but we call.Page.RenderString
a method..Page.RenderString
a method, we document it under the "Functions" section.We've already done this for
.Pages
. Although under the "Variables" section, the title is "Pages methods".Tasks
Completed on or before 4 Nov 2023:
Completed on 19 Feb 2024:
Completed on 8 Mar 2024:
Completed on 15 Jun 2024:
I've been thinking about doing this for a while: #1639
The text was updated successfully, but these errors were encountered: