codidact / qpixel

Q&A-based community knowledge-sharing software
https://codidact.com
GNU Affero General Public License v3.0
393 stars 68 forks source link

OpenGraph HTML meta tags are broken or missing #1391

Open ws909 opened 2 months ago

ws909 commented 2 months ago

I copied an answer of mine from SO to SD-CD, so I checked the HTML sources of the webpages on both websites to compare them, and found several issues with the CD page, some of which concern OpenGraph.

The problems I found in the HTML source for CD's page:

cellio commented 2 months ago

What does this metadata do? I'm not familiar with OpenGraph and I'm not spotting differences in the rendered answers. Can you elaborate?

ws909 commented 2 months ago

I'm going through various SEO issues with Codidact, and this is one of the things covered by that. The OG API was first created by Facebook, and is now used by services to read a website and present it in a small format for instance on social media. Some sources claim search engines also use that data, although I am not entirely sure. Either way, I think it's important to resolve this.

ArtOfCode- commented 2 months ago

@ws909 re og:image being broken - where are you seeing this? The current code for it is <%= "https://#{RequestContext.community.host}#{SiteSetting['SiteLogoPath']}" %>, which off the top of my head should be correct.

ws909 commented 2 months ago

@ArtOfCode-

From the HTML source of the Software Development CD page linked in the first post. Currently at line 51 when I just now loaded it up in Safari (last tag in the <head>):

<meta property="og:image" content="https://software.codidact.comhttps://codidact.com/community-assets/software/logo-large.png"/>
ws909 commented 2 months ago

SiteLogoPath must be the full URL, yet the code assumes it's only a partial or relative URL.

ArtOfCode- commented 2 months ago

Ah, I forgot we use full URLs there. It was built to use a path on the same domain but it doesn't actually make a difference... Except here.