Additional field for posts (SOLVED)

Is it possible to add another field to the post sidebar in the editor, which would then be included in the published post?

I use the Excerpt field for social media workflow, and don’t want it included in total in the post (especially since it is often a copy of the first graf). But, I sometimes would like to have a subhead at the top of the post. Is there a way to add a field for that? I could then do an IF in the code to include it if it exists.

Thanks!

Internal tags are your best bet here!

You can do something like

{{#has tag="hash-show-excerpt"}}
  {{excerpt}}
{{/has}}

If you have a post where you want to show the excerpt, you can add the #show-excerpt tag to it

1 Like

Thanks for the reply!

However, I want to use the excerpt field in every post as the excerpt for social media, and as the excerpt in the post card.

What I need is a SECOND field into which I can type a subhead and have it show in the post only if it has content. I know how to use the handlebars to check for it in the post and show it; what I don’t know is how to add a second field to the editor sidebar.

I don’t follow for this part - Are you basically saying you’re looking for something like this on a post page?

{{excerpt}}
{{more_context}}
{{feature_image}}
{{content}}

I am using the excerpt field for social media, and do not want it to show in the post at all. (I am feeding my social media automation via the RSS feed, which includes the excerpt.)

Basically, I want

– title –
– subhead if exists –
– body –

So, I want some way to add a subhead below the title, but only on some posts.

Can you start your post with an HTML card that contains the subhead? e.g.

<div class="subhead">
<p> Paragraph 1</p>
<p> Paragraph 2</p>
</div>

Sure – that would be fine, and easy to do.

So that I don’t have to do a bunch of experimentation with post.hbs :wink:, how would I code it to show under the headline and NOT in the post content? If I can figure that out, I can edit the post.hbs file to do what I want.

If you are using the excerpt for post cards and social media, couldn’t you just repurpose the Facebook description field {{og_description}} or even the meta field {{meta_description}} and then only display this as and when required by using a private tag e.g #displayexcerpt

Then add to your theme using the Has helper.

{{#has tag=“#displayexcerpt”}}
{{og_description}}
{{/has}}

1 Like

Thank you! That’s a really interesting idea. I don’t use any of those fields, typically, because I use CoSchedule to post to FB and Twitter. Using the meta field has some interesting possibilities, because Google typically picks up the excerpt, but often truncates it. If I use the meta field for a subhead, though, it would be much shorter and (typically) still be directly related to the story.

[[ off to try it ]]

1 Like

Ghost has no plans to introduce custom fields so they are the only options we are left to play with. I hope it works out.

I know this post is marked as solved, but I have created a tool that does exactly what you are looking for. With Gaspr.io https://gaspr.io/ you can add custom fields to Ghost in a few steps. It provides an interface to manage custom fields and create templates using Handlebars to display the data.

If you are interested let me know and I will help you get started :slight_smile:

Yes, so far it looks like it is. I have to preview the post to see the subhead (of course) and it took me a few tries to get the formatting right, but it’s now an option. And using the meta field will be good as well, I think.

1 Like

Thanks for the offer! I’m good for now, as I don’t need other fields. However, I did look at your product, including watching the video. Couple of questions:

  1. Where are the templates stored, on our Ghost installation or on your site?
  2. If they are stored on your site, when they are inserted do they create a static HTML block, or does the post have to contact your site every time it is refreshed?

Thanks for jumping in – Gaspr looks pretty interesting!

Thank you Bruce. Answering your questions:

  1. The templates are stored on our site.
  2. The way it currently works is, the app will generate static HTML with the template and the data it finds for that page/post and updates the post itself with this new html block. It will do that everytime a change is made to the post.