Skip to content

GetPage returns a page when I think it should return nil #11883

@jmooring

Description

@jmooring

I understand that .GetPage on both Page and Site have some fuzziness when finding a page, but I was surprised by this.

content/
├── p1/
│   ├── index.md
│   └── p1.xyz
└── _index.md

layouts/_default/home.html

{{ with .Page.GetPage "p1.xyz" }}
  .Page.GetPage: {{ .RelPermalink }}
{{ end }}

{{ with .Site.GetPage "p1.xyz" }}
  .Site.GetPage: {{ .RelPermalink }}
{{ end }}

public/index.html

.Page.GetPage: /p1/

.Site.GetPage: /p1/

I would expect both methods to return nil because p1.xyz is a page resource, not a page.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions