Would this be possible? I’ve been appending a link to the forum home page to tweets but would rather do without the image. I guess the opengraph image Is used (currently I haven’t uploaded one).
Is there a way of getting rid of the image altogether? None of my topics will have images either so I’d be happy to do this site-wide.
As a second best, what if upload a really small logo to opengraph image? Would Twitter just resize it to be the same as it is now?
Thanks. I will look into how to create a Discourse plugin and how Ruby works!
In general, though, will I have to replace the whole method, and look out for relevant changes on every Discourse upgrade?
…
Creating a plugin seems like something I won’t have time for in the short term. What would happen if I found the relevant file in my Discourse installation and just commented out these lines each time I upgrade?
if opts[:twitter_summary_large_image].present?
result << tag(:meta, name: 'twitter:card', content: "summary_large_image")
result << tag(:meta, name: "twitter:image", content: opts[:twitter_summary_large_image])
elsif opts[:image].present?
result << tag(:meta, name: 'twitter:card', content: "summary")
result << tag(:meta, name: "twitter:image", content: opts[:image])
else
result << tag(:meta, name: 'twitter:card', content: "summary")
end
When you upgrade these files are overwritten when the Discourse repo is pulled into your workspace (folder); so you cannot simply “comment out” lines in a file because those files will be overwritten.
Although there are myriad ways to do things in the world of tech possibilities, the generally accepted way to modify the core is via a plugin, as mentioned earlier.
Generally speaking, in this case you would override the method in that module with your code.
Best to create a development environment because you do not want to break your production application.
This is a relatively simple plugin to write, but since you are not yet experienced with this style of development, you might consider posting over in marketplace and asking one of the well-heeled developers who make a living developing plugins to help you.
Otherwise, you can set up a development environment and have fun learning to develop Discourse plugins.