I’m not sure if this is a bug or my misunderstanding but .File.Dir
appears to return a relative path when used with a standard archetype and an absolute path when used with a directory based archetype.
If anyone can explain what’s happening or how I can get a relative path from a directory based archetype that would be great, thanks.
what you were doing or what you tried
Using .File.Dir
in a directory based archetype
what you expected
A path relative to content/
to be returned
e.g. posts/test-post/
as happens with a standard archetype and is documented here
what actually happened
An absolute path is returned
e.g. /home/tom/test-site/content/posts/test-post/
example repo
hugo env
Hugo Static Site Generator v0.72.0-8A7EF3CF/extended linux/amd64 BuildDate: 2020-05-31T12:14:23Z
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.14.3"