--- # Do not remove front matter. --- Hugo determines the _next_ and _previous_ page by sorting the site's collection of regular pages according to this sorting hierarchy: Field|Precedence|Sort direction :--|:--|:-- [`weight`]|1|descending [`date`]|2|descending [`linkTitle`]|3|descending [`path`]|4|descending [`date`]: /methods/page/date/ [`weight`]: /methods/page/weight/ [`linkTitle`]: /methods/page/linktitle/ [`path`]: /methods/page/path/ The sorted page collection used to determine the _next_ and _previous_ page is independent of other page collections, which may lead to unexpected behavior. For example, with this content structure: ```text content/ ├── pages/ │ ├── _index.md │ ├── page-1.md <-- front matter: weight = 10 │ ├── page-2.md <-- front matter: weight = 20 │ └── page-3.md <-- front matter: weight = 30 └── _index.md ``` And these templates: {{< code file=layouts/_default/list.html >}} {{ range .Pages.ByWeight }}