مخطط غرافيكي مفتوح لنقاش

Sponsored by Netwrix

:information_source: Summary Update your Open Graph data programmatically and enhance your SEO
:hammer_and_wrench: Repository Link GitHub - discourse/discourse-open-graph
:open_book: Install Guide How to install plugins in Discourse

Features

This plugin lets you override your Open Graph, Twitter, title, and description tags.

Configuration

This plugin ships with only one setting: Open graph overrides, which opens to this modal:

You have a URL property, which will match and use it to override your meta tags – this will be your ID.

Title - Will override the title, og:title, and twitter:title tags. If empty, it will default to the original value.

Description- Will override the description, og:description, and twitter:description tags. If empty, it will default to the original value.

Settings

Include a table of settings and setting descriptions

Name Description
discourse_open_graph_enabled Enables open graph plugin
open_graph_overrides Editor for your overrides
8 إعجابات

I’m really excited this exists. The thought I just had tho was: does this work for topics?

I assume no, because then one might have to manually type in open graph info for each topic.

Then I thought: what if the topic description were autogenerated by Discourse AI summarizing the topic?

Maybe using Discourse AI Topic Summary 🤖

The title could be the same and description the AI summary. And maybe tweakable if people want to edit it, similar to on Wordpress with Yoast.

Any thoughts on this?

إعجاب واحد (1)

I think it does! But it would be necessary to add an override for every topic.

Maybe this could be a feature for AI Topic Summary–it could override the metadata content based if they had the ai summary in the topic itself.

Some pseudo-code, inspired by this snippet in the Open Graph plugin:

  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
إعجابَين (2)

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

إعجاب واحد (1)

As someone who is fairly new to Discourse; cant this already be done in the Discourse settings?

إعجابَين (2)

With this precision(regexing) no.

And eventually we could add images dinamically

إعجابَين (2)

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?

إعجابَين (2)

Sure! One very good example is the category list page:

We can override both title and description to be more descriptive

Or for very specific topics that you want to have a different text when sharing in social media:

We could change to be just the title and some kind of small description

إعجابَين (2)

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!

إعجابَين (2)

Yes, I’d love this to plug it into the placid.app service that I use and have it return the image that then gets used.

Maybe I’ll play with it when I have some free time.

إعجابَين (2)