Here’s my use case:
I have a post type that is identified by an internal tag and a custom route. I would like to have a “URL” field that I use in the theme as a link to the source.
What is the best way to do this?
I was think I could use the HTML field as a snippet perhaps and use JS to render the UI I want. Or perhaps use the excerpt field? Is there a recommended approach here? How are you solving for custom fields?
The HTML field is the whole post body (everything in the editor after the title & featured image). That’s probably not what you want. :)
Maybe you meant you’d use an HTML card in the body of the post. That’d be a fine spot to stash the value, but handlebars won’t be able to extract it directly (all it can do is return the whole post body, not just part of it) - you’d have to use JS. I’ve done something similar for one client - we took the contents of the first ‘bookmark’ in the post and inserted that URL elsewhere in the page. That had the advantage that he didn’t actually have to handle any HTML, just needed to put a bookmark at the top of the page if he wanted it used.
You could use the excerpt - be aware that some themes display it (but yours might not), and the built in Ghost search will /search/ it, which might lead to some strange search hits. It’s also length limited. I don’t know how many characters (300?) off the top of my head, but it might not let you put in some very long URLs.
@Cathy_Sarisky Yes, I meant the HTML card. The bookmark card may be even easier! I think I’ll use that.
Thanks for letting me know about the excerpt and search, I didnt think about that.