Page .Permalink / .RelPermalink difference?

While I’m well acquainted with absolute and relative paths, I haven’t been able to figure out how .Permalink and .RelPermalink differ in practice. For instance when iterating over pages in a list template, either property gives me what I would call an absolute path. I guess I’d stick to .Permalink either way, but I’m curious.

Let’s say you are running locally with hugo server then for the homepage:

.RelPermalink: /
.Permalink: http://localhost:1313/

.RelPermalink as the name says is relative to the root / domain. .Permalink in that sense is absolute (like the link you would share with someone).

Hope that helps.

Edit: I normally always use .RelPermalink.

1 Like

Yeah, that’s what I expected, but for me the page didn’t update accordingly, hence my confusion. I think I often run into caching issues with Hugo, making it very difficult to learn by trial-and-error.

Thanks!

I suspect that many such issues are HTTP client caching (the browser); we have a flag to disable this in the server, but I recommend to always run with something ala the Chrome dev console open (with caching turned off (default)) when editing Hugo templates.

2 Likes