Debian Codegraph @

docs/content/en/methods/page/Weight.md

raw
1 ---
2 title: Weight
3 description: Returns the weight of the given page as defined in front matter.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: int
9 signatures: [PAGE.Weight]
10 ---
11
12 The `Weight` method on a `Page` object returns the [weight](g) of the given page as defined in front matter.
13
14 {{< code-toggle file=content/recipes/sushi.md fm=true >}}
15 title = 'How to make spicy tuna hand rolls'
16 weight = 42
17 {{< /code-toggle >}}
18
19 Page weight controls the position of a page within a collection that is sorted by weight. Assign weights using non-zero integers. Lighter items float to the top, while heavier items sink to the bottom. Unweighted or zero-weighted elements are placed at the end of the collection.
20
21 Although rarely used within a template, you can access the value with:
22
23 ```go-html-template
24 {{ .Weight }} → 42
25 ```