Custom post metadata to use in integrations

Hey folks!

I’ve built custom integrations to fan-out my posts to Telegram and Medium and now want to do the same for Twitter.

The basic integration is pretty trivial, but I want to be able to customize tweet message for each post.

I want to add a bit of text before post link, so it will look like “ Let’s discuss is it good or bad for developer to live in polyglot environment: Чи добре бути поліглотом? ”. This text is different for each post.

Please note it’s not the same as og:description metadata.

What’s the best way to achieve that assuming I building integration by myself using Ghost API? I suppose the Custom fields for posts is the solution, but Kevin clearly stated it’s not on the roadmap now.

Maybe some hidden html I can parse in my integrations? Any ideas?

I’m not 100% sure on what you’re trying to do (and I’m not sure the link is working), but I think the HTML option would work.

Two other options:

  • You could use the Code Injection header to store an object with the relevant data fields.
  • If you’re looking to generate this info automatically, you could create this data object at the theme level and store it in your head as a JS object.

I want to add some metadata to the post so I will be able to use it in my integrations.
Right now there is no way to add such metadata to the post itself.

My use-case is twitter automation. I want to create tweet with link to my post and some text automatically. I want this text to be specific for every post.

So tweets will look like
«Hey folks checkout my new post on career: https://…»
«Bored by modern infrastructure? Me too: https://…»

And not like:
«New post was published in my blog: https:///» when text is the same for every post.

Cool! I think your best bet would be to use the Post → Code Injection option, where you could add in a JS object that could be picked up in your automation.

<script>
  const twitterMetadata = {
    preText: 'Hey folks...',
    url: 'https://',
    ...
}
</script>
1 Like