`page` vs `.` - docs and use

I can’t find the documentation for page (as in page.Title for instance) in the docs due to the terms weight. Maybe you could point me in the right direction.

Specifically I am having an issue with the following use inside a partial:

{{- $icons := page.Scratch.Get "icons" -}}
... 
{{- page.Scratch.SetInMap "icons" $iconname true -}}

On a single page, uncached as partial, this method “lost” some of the Icons set inside the same partial, but removing the page part from the equation fixed this.

{{- $icons := .Scratch.Get "icons" -}}
... 
{{- .Scratch.SetInMap "icons" $iconname true -}}

And again, no caching is involved.

I want to understand what exactly page is doing that is different from .. Pretty sure that is explained in the docs, but I can’t find the proper location. (Maybe a weight parameter for Algolia somewhere could override the results of such common words. (short methods like in, etc are hard to find too (without knowing that collections will bring up a list of those functions. )

The global page function is described here:
https://gohugo.io/functions/global/page/

Not sure how to get it bumped in search results.

1 Like

Knowing it’s called a global method helps for the next search.

I don’t know how you configure Algolia in the docs section. It offers weights for pages that are more important and you can manually add terms and its results. It might be as easy as an additional frontmatter parameter depending on the solution you use to create the index.

But knowing where the doc for page is located is enough for me :slight_smile: Thanks.

We’re using a really old API with a legacy offering, and our config abilities seem to be quite limited… so I think we live with this one.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.