[SOLVED] .Site.GetPage doesnt work with any form of RelPermalink

Assume relative url = /post/2017/

This line but with the variable as $regex, $stringify, $ trim etc they all fail

{{ $home := $.Site.GetPage “section” $regex }}

  1. regex (fails)

{{$link := .RelPermalink }}
{{ $regex := replaceRE “^/|/$” “$1” $link }}

  1. Try the string function (fails)

{{ $stringify := string $regex }}

  1. Try avoiding regex and using trim function (fails)

{{ $tri := strings.TrimRight “/” $link }}
{{ $trim strings.TrimLeft “/” $tri }}

  1. If you use a string which is exactly the same it works

{{ $string = “/post/2017/” }}

This is the problem, I can’t put a variable in the site.getpage thing it says:
runtime error: invalid memory address or nil pointer dereference

But I don’t know why. All the output above from RelPermalink looks like /post/2017/, the same as just string $var := “/post/2017/”. But it doesnt work

EDIT
So I just found this post String literal works, but (seemingly) equivalent argument doesn't?

And used this:

I’m still pretty shaky on Hugo, but Ill learn I guess.