Skip to content

Bug in relURL with leading slash when baseURL includes a subdirectory #9994

@jmooring

Description

@jmooring

This is not a new issue; behavior present in v0.54.0 through v0.100.2.

config.toml

baseURL = 'https://example.org/foo/'

template

{{ $url := "/foo/bar" }}
{{ $url | relURL }}
{{ $url | absURL }}

result

/foo/foo/bar
http://localhost:1313/foo/bar

Notice that the subdirectory from baseURL is repeated when using relURL, but it is not repeated when using absURL.

This has come up a few times in the forum, usually in conjunction with menu iteration:

Note that the same differences are present when comparing relLangURL and absLangURL.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions