register_modifier(:meta_data_content) do |content, property, opts|
next content if property == :url # we don't want to override the url
url = opts[:url]
override = Topic.find_by_url(url)[:ai_meta_data_override]
if override
content = override[property] if override[property] # it can be either :title or :description
end
content
end
There doesn’t need to be any AI built in here – all you need for dynamic OG images is to be able to pass parameters from the topic into the URL like ?title=Hello+World&date=2025-04-27
This could be a template system like {{topic.author.username}} or whatever you think makes sense here
That will let the user plug into any existing service that generates OG images, or connect to one of their own, or to a future offering by Discourse if you want first class support
Oh ok would you mind giving me a use case when you would like to override the settings? Is it when you are sharing a link from your forum, for example a topic that it will then look different or mainly for SEO concerns?
That is very cool. I know some companies have some impressive dynamically added images to open graph to make it more enticing. I hope this feature gets added to Discourse core or as a standard plugin. Great work!