What would be the best way to customize my Discourse install's excerpt and to place necessary opengraph tags into the head html?


#1

TL;DR: What would be the best way to customize my Discourse install’s excerpt and to place necessary opengraph tags into the head html?


Recently, I had the wonderful help of @zogstrip who fixed some issues in the way Discourse creates excerpts: Difficulties with Facebook sharing and opengraph tags? Wrong images, excerpt contains image text

The thing is, my client is very specific about how he wants excerpts to be built (does not even want the [image] text in there), and is particularly adamant that images appear properly via opengraph tags, as often, the images aren’t appearing at all when sharing.

As I don’t want to go against what the Discourse team thinks to be ideal for the majority, I was thinking about how to extend/customize my particular Discourse install.

I’m a bit new to Rails, and in particular, Docker. Usually, I would imagine I could just look in the code and customize as I wish, but I’m confused about the process of making changes to files when I feel like an upgrade over git from the official stream would start getting confused/mismatched.

I’ve read the few tutorials/howtos that are around, but they seem limited to loading extranneous js/css while I would need to affect the actual rendering templates.

Any direction would be of great help, unfortunately my client is getting very upset with me due to the difficulties we’ve been facing with effective Facebook sharing.

Quoting the other thread, in essence I would like to:


(Kane York) #3

Here you go:

<img src="//discourse-meta.s3-us-west-1.amazonaws.com/original/3X/0/b/0b7aef6dfb29f8dca0756d16ac1ac4e7dbd9a53d.png" width="690" height="262">

EDIT: Wait, no. Here it is:


#4

@riking Ah, thanks for that, but I had meant in a dynamic way, in the form of a plugin where it could actually parse the content and then insert an appropriate meta tag as discussed in the first post.