-
-
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
Clarify the difference in behavior of Site vs Page GetPage #546
Comments
I'm not sure I follow (and please don't ask me to read the thred on the forum):
Should return the same Page. If |
@bep I have committed a very light weight reproducible example at https://gitlab.com/hugo-mwe/hugodocs-issue-546. See the "But this fails!" section in the layout file. |
OK, then I misunderstood the problem -- "post-1" is not unique. Maybe in that page context, as you say it, but that is not how this works. |
I now realize that it's not how this works. But it's not intuitive given that So it should be explicitly documented that the arg to |
That argument could be had and a possible improvement (possibly expensive): But I think it helps to think about Page.GetPage as also supporting relative paths. |
I am not denying the utility of the new function. Also I don't suggest adding this feature ASAP.. (it would be awesome if the long standing bugs like Next/Previous and NextInSection/PrevInSection get love before addition of more new features :)). I opened this issue in HugoDocs just so that this nuance of the context when calculating the ambiguity is properly documented (i.e. the .Site context is used for ambiguity detection whether |
@bep Actually turns out that the "Page context" association with This works! .. even though the
{{ with .Site.GetPage "/posts/bar" }}
{{ with .GetPage "post-2" }}
{{ printf "Title of a post-2 post anywhere in Site: %s" .Title }}<br />
{{ end }}
{{ end }} So.. for
|
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. |
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2018 Closes gohugoio#2051 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2018 Closes gohugoio#2051 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2018 Closes gohugoio#2051 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2018 Closes gohugoio#2051 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2018 Closes gohugoio#2051 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2018 Closes gohugoio#2051 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276
Closes gohugoio#53 Closes gohugoio#447 Closes gohugoio#546 Closes gohugoio#1163 Closes gohugoio#1400 Closes gohugoio#1406 Closes gohugoio#1547 Closes gohugoio#1622 Closes gohugoio#1637 Closes gohugoio#1639 Closes gohugoio#1667 Closes gohugoio#1745 Closes gohugoio#2001 Closes gohugoio#2018 Closes gohugoio#2051 Closes gohugoio#2256 Closes gohugoio#2264 Closes gohugoio#2275 Closes gohugoio#2276 Closes gohugoio#2297
For a path like
/foo/bar/abc.md
,.Site.GetPage "abc"
will work (assuming that the "abc" name is unique in the whole site).But given that the /foo page context is stored in
$foo
,$foo.GetPage "abc"
is not expected to always? work.The Page version of GetPage expects either an absolute path (starting with /) or a valid relative path from the current context. It is not designed to do a "lookup" anywhere in the given context.
This distinction needs to be made explicit in the docs.
The text was updated successfully, but these errors were encountered: