Aref - anchorized ref shortcode

Hi,

I don’t know if maybe anyone suggested it, but I find it often usable when cross-linking to automagically generated headings:

{{- $s := (split (index .Params 0) "#") -}}
{{- if (isset $s 1) -}}
{{-   index $s 1 | anchorize | print (index $s 0) "#" | ref . -}}
{{- else -}}
{{-   index .Params 0 | ref . -}}
{{- end -}}

Then one can use it like:

{{< aref "12-concurrency#Transactional references" >}}

P.

1 Like

I moved this to tips and tricks since that is what it is.
@siefca can you please give an example of what the HTML source looks like after using this?