In Hugo, I sometimes want to link to other posts in a see also section. I want to just give the post name and be done with the link. However Hugo only provides ref and relref.

So I made the following shortcode in layouts/shortcodes/link.html :

{{ $pageName := index .Params 0 }}

{{ with .Site.GetPage $pageName }}
  <a href="{{ .RelPermalink }}">{{ .Title  }}</a>
{{ end }}

When called liked this in a page :

{{< link page_x >}}

It produces the following HTML :

<a href="page_x-location">page_x-title</a>