Version-agnostic page/section references

We create a hyperlink to another page in the doc portal with a reference like this:
<a href=“{{< ref “v1-abcd-additional-options-in-cloud-accounts-screen#section-adjusting-the-cloud-account-scan-schedule” >}}”>Adjusting the cloud account scan schedule

The part “#section-adjusting-the-cloud-account-scan-schedule” is an optional section reference (anchor); it can be omitted.

Finally, there are on-page references to a different section on the same page that can omit the first part, like this:
see <a href=" {{< ref “#section-cloud-account-providers” >}}">Cloud account providers below

Here’s the problem. In a reference to another page, the doc version number must be included. It could be “v1-”, “v2-”, etc. This reduces document reusability.

Which Hugo code processes these references, and how can I change it to do the following:

  • If there’s no version reference included, then use the version of the current markdown page.
  • Otherwise, use the version reference that’s included.

Thanks!