How to get the current url in Hugo
Learn how to get the current URL in Hugo using the .Page.RelPermalink value, trimming the slashes to get a clean relative path like ebooks or ebooks/php.
~~~
{{ trim .Page.RelPermalink "/"}}
This is the result:
yoursite.com/ebooks -> "ebooks"
yoursite.com/ebooks/php -> "ebooks/php" ~~~
Related posts about hugo: