Getting the current page url

This sounds obvious but I couldn’t find anywhere in the documentation or forum on how to get the current page’s url. The closest on is .URL of a node, but that does not exists for a page.

I need the current page URL to feed into facebook comment plugin.

Thanks!

{{ .Permalink }}

The {{ .Permalink }} seems not respect the query params, so it stips the ?some-param part of a url, any workarounds for that?

What query param would it be in a permalink?

1 Like

Thanks for quick reply. What I’m trying to do is to get query params from the current url of a page.

Something like: localhost:1313/join?1205

So I want to get the 1205 inside my Hugo template. Both .Permalink and .URL give me the current url without the params.

So it could be something different than Permalink or URL, I just need to get to the params.

Thanks in advance!

  • Hugo is a static generator
  • `Permalink´ points to a static file on disk.
  • I guess it may be possible to set url = /join?1205 in front matter, but I’m not sure how we would translate that to a file on disk. And I’m not sure I understand …