Create a post for listing all my posts

Hi there, the following code was working for me but with my latest update doesn’t.

           {{ range ($.Site.GetPage "taxonomyTerm").Pages }}
          <li><a href="{{ .Permalink }}">{{ .Title}}</a></li>
          {{ end }}

any help?

Thanks in advance.

Hi @igoumeninja. Just to clarify: are you trying to get all your “posts” or are you trying to get all posts with a specific taxonomy term associated with them?

If you want to get a listing of all posts, assuming your posts section is ./content/posts/ try:

{{ range where .Site.RegularPages "Section" "posts" }}
1 Like

Further, if you’re looking for a list of pages with the same tags, for example, you can modify the example from the docs:

{{ range where ( where .Site.Pages ".Params.tags" "intersect" .Params.tags ) "Section" "posts" }}
  {{ if ne .Permalink $.Permalink }}
    <li><a href="{{ .Permalink }}">{{ .Title}}</a></li>
  {{ end }}
{{ end }}

You may also want to check out related content, depending on how long you’ve been using your current templating.

2 Likes

It works like a charm!
Thanks a lot rdwatters :pray:

1 Like