I have a few ideas based on your snippet, but it would also help if we could see your source repository as per Requesting Help.
Before <article>
you need
{{ range $pages }}
and after </div>
you need
{{ end }}
Also do you have a layouts/_defaults/baseof.html
defined? (If not, the define main won’t work).
And finally, I presume you have files under content/posts
so that
picks up pages?
HTH.