Custom meta fields in posts

I’m trying to port my current blog over to Ghost. One of the features I have on my blog right now is the option to add a custom hex colour code to my post, which is then used in a custom <style> tag on the Post page.

Is it possible to do something like this with Ghost? I don’t need any fancy editor features like a colour picker, just a key/value input that I can use in my handlebars templates.

Ghost doesn’t have custom fields in the same way, but it does have a codeinjection_head and foot block as well as an HTML card - so you can include your custom styles into any of those.

I’ve migrated sites in the past that did exactly what you describe, and we just put the <style> block directly into codeinjection_head. It works the same but without a specific UI :slight_smile:

Weirdly, the TAG pages do let you set an accent_color in hex - But I haven’t found it used anywhere in Casper… maybe it’s historic

Yup, tags have an accent colour and I use those colours in my theme. But posts don’t.

I solved it by calling a JS function with the post colour in the codeinjection block (because it needs to apply a bunch of styles and calculate the proper values based on the given colour). Still, this seems like something that should be applied on the backend rather than the frontend.