Filter posts by Custom Post Template

I have created new Custom Post Templates like on Custom Post Templates · Issue #9060 · TryGhost/Ghost · GitHub and now I would like to know if I can use a filter to only display posts that use this template in a list

Hey!

You could use the get helper to query posts.

{{#get "posts" filter="custom_template:[name]"}}
  {{#foreach posts}}
    {{url}}
  {{/foreach}}
{{/get}}
4 Likes

Do we use the full name custom-template or just the template part? This code doesn’t seem to work for me. My template name in the admin is “Newtemplate” but the name of the file is custom-newtemplate.hbs

It worked for me using the filename, so filter=“custom_template:[custom-newtemplate]” in your example.