Hi. I have struggled with this for some hours, and it’s about time to ask for help
Trying to create a SLICE of matching strings, but have som issues with the WHERE function.
This works fine:
{{ $rentals := where .Site.RegularPages "Params.property" "eq" "eiendommer/eiendom1.md" }}
This dont work:
{{ $rentals := where .Site.RegularPages "Params.property" "eq" .File.Path }}
If I print .File.Path
I get “eiendommer/eiendom1.md”
So I cant figure out why it works with a basic string, and not with the variable with the identical string.
I have also tried this with no luck:
{{ $rentals := where .Site.RegularPages "Params.property" "eq" (string .File.Path) }}
UPDATE
This is now working.
Could not use .File.Path
because the output gets wrong. So instead I had to use the .RelPermalink
Here is the solution:
{{ $thispage := .RelPermalink | strings.TrimLeft "/" | strings.TrimRight "/" }}
{{ $rentals := where .Site.RegularPages "Params.property" (printf "%s.%s" $thispage "md") }}