Skip to content
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

Handle file names with multiple dots when getting a page #10864

Closed
jmooring opened this issue Mar 25, 2023 · 2 comments
Closed

Handle file names with multiple dots when getting a page #10864

jmooring opened this issue Mar 25, 2023 · 2 comments
Assignees
Milestone

Comments

@jmooring
Copy link
Member

Overview

The functions and methods below cannot resolve a path to a page if (a) the filename (including the extension) contains multiple dots, and (b) the path argument passed to the function or method does not include the file extension.

Examples

Path arg does not have file extension

Template code Result
{{ .Page.GetPage "news/2021/0.91.2-relnotes" }} error REF_NOT_FOUND
{{ .Site.GetPage "news/2021/0.91.2-relnotes" }} error REF_NOT_FOUND
{{ .Page.Ref (dict "path" "news/2021/0.91.2-relnotes") }} error REF_NOT_FOUND
{{ .Page.RelRef (dict "path" "news/2021/0.91.2-relnotes") }} error REF_NOT_FOUND
{{ ref . "news/2021/0.91.2-relnotes" }} error REF_NOT_FOUND
{{ relref . "news/2021/0.91.2-relnotes" }} error REF_NOT_FOUND

Path arg has file extension

Template code Result
{{ .Page.GetPage "news/2021/0.91.2-relnotes.md" }} OK
{{ .Site.GetPage "news/2021/0.91.2-relnotes.md" }} OK
{{ .Page.Ref (dict "path" "news/2021/0.91.2-relnotes.md") }} OK
{{ .Page.RelRef (dict "path" "news/2021/0.91.2-relnotes.md") }} OK
{{ ref . "news/2021/0.91.2-relnotes.md" }} OK
{{ relref . "news/2021/0.91.2-relnotes.md" }} OK

Motivation

If, on an existing site, you implement a link render hook that resolves link destinations (no extension) to pages, the render hook will not be able to find the page, limiting your ability to create portable links. Again, this only applies to filenames with multiple dots.

The path used in the examples above is from the Hugo docs site.

This enhancement would also resolve #9918.

@bep bep added this to the v0.112.0 milestone Mar 29, 2023
@bep bep self-assigned this Mar 29, 2023
@bep bep modified the milestones: v0.112.0, v0.113.0 Apr 15, 2023
@bep bep modified the milestones: v0.113.0, v0.114.0, v0.115.0 Jun 8, 2023
@bep bep modified the milestones: v0.115.0, v0.116.0 Jun 30, 2023
@bep bep modified the milestones: v0.116.0, v0.117.0 Aug 1, 2023
@bep bep modified the milestones: v0.117.0, v0.118.0 Aug 30, 2023
@bep bep modified the milestones: v0.118.0, v0.119.0 Sep 15, 2023
@bep bep modified the milestones: v0.119.0, v0.120.0 Oct 5, 2023
@bep bep modified the milestones: v0.120.0, v0.121.0 Oct 31, 2023
@bep bep modified the milestones: v0.121.0, v0.122.0 Dec 6, 2023
@bep bep removed this from the v0.122.0 milestone Jan 27, 2024
@bep bep modified the milestones: v0.123.0, v0.124.0 Jan 27, 2024
@jmooring
Copy link
Member Author

This was resolved with #11894

@bep bep modified the milestones: v0.124.0, v0.123.0 Jan 31, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants