Creating a link from a .md parameter

I have a .md file which has a parameter ‘page_url’ which I would like to create links with in my page.

In my .md file
page_url: some-page.md
some pages are also saved as:
page_url: /resources/_index.md

If I link to the parameter directly I get a 404 because of the .md extension
<a href="{{ .page_url }}">Learn More</a>

I have tried:
<a href="{{ substr .program_target 0 -3 }}" class="font-medium">Learn More</a>
That seems to work, but sometimes I get an error with:
Execute of template failed: template: role_pages/single.html:52:23: executing “main” at : wrong number of args for trim: want 2 got 3

I have tried trimming:
<a href="../{{ trim .program_target ".md" || "_index.md" }}" class="font-medium">Learn More</a>

But this causes an error as well.

Try:

{{ ($.Site.GetPage .page_url).Permalink }}

Also see the .GetPage docs

That worked - thanks!