You’ll need to use printf to format the .md reference.
I.e. something like
{{ $hash := .Params.filehash }}
{{ $md := printf “%s” (print “/specs/project-” $hash “.md”) -}}
{{ if (fileExists $md) -}}
file exists
{{- end }}
Please note that this is untested (I’m still learning), but I believe something along these lines might work. Hopefully, I have got you a little closer to solving this.