Custom Post Templates with Tags

Looks like there are some official solutions as well as simple workarounds to pre-populate or format content within a post, but is there a way to do something similar with the post details? Specifically looking for pre-filling tags for certain types of posts. For example, if we are publishing a translated version of an existing post, there are a number of public and private tags that should always be included (for content groupings and other organization).

Secondarily (and I suspect that this may already be supported just by tweaking the theme) is there a way to designate a fallback image if no preview image has been added?

Let’s start with your second question because the solution is straightforward. You can edit your theme to use a fallback image. Specifically, you would check for the existence of a feature image, and, if there isn’t one, supply a fallback.

{{#if feature_image}}
  ... code for the feature image
{{else}}
  ... code for the fallback  image
{{/if}}

For prefilling a post, there isn’t a straightforward solution built into Ghost. We have custom templates, but those won’t prefill tags. You could rig up something with the Admin API, which would create a draft post with the requisite tags and other info, but this would require quite a bit of work on your end and wouldn’t be integrated directly with your Ghost application.

If the feature is something that you’d like to be added to Ghost, I encourage you to make a post in the #ideas channel, as we follow interest there for prioritizing what gets added to Ghost.

1 Like