Exclude current post from related content

I use the code below to show related content from the same nested section. The “Type” is set in the root section’s _index.md using cascade. However, some posts in one section show up in the related section despite this being set "Permalink" "ne" .Permalink (this section has 10 posts). Is there a way to make this work?

        {{ $page := where (where site.RegularPages "Type" "post") "Permalink" "ne" .Permalink }}
           {{ $page := .CurrentSection }}
            {{ $Posts := $section.RegularPages }}
              {{ $post := shuffle $Posts | first 3 }}
                {{ range $post }}  
                  <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
               {{ end }}