How to loop 3 latest blogposts on startpage?

hi, i have a folderstructure like this

├─ content
   ├── blog
       ├──blogpost1.md
       ├──blogpost2.md
       ├──blogpost3.md
       ├──blogpost4.md

And i would like to display the 3 latest blogposts on my startpage. but i cant get it to work. I dont want to use the {{ range first 3 .Site.RegularPages }} because it will display other content files and i just want to display the md files in the blog folder.

Try:

{{ $blog_pages := where .Site.RegularPages "Section" "==" "blog" }}
{{ range first 3 $blog_pages }}
1 Like