go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.95k stars 5.48k forks source link

Markdown pages use page title for OpenGraph link preview #22243

Open aschrijver opened 1 year ago

aschrijver commented 1 year ago

Feature Description

When dropping a link to a Markdown file in a git repo, e.g. in a Matrix chat or Discourse forum, then the generated link preview should be based on the first <H1> title in this markdown document.

Some rules:

If the H1 can be considered as the title of the page, an og:title is added to the <meta> of the page.

Possible extensions

Note

This feature request relates to downstream issue forgejo/#173.

Screenshots

Here is the link to markdown document titled FEP-1b12: Group federation in the fediverse/fep repository, after it was posted to a Matrix chatroom:

forgejo-markdown-link-previews

How it may look like after the feature is implemented:

forgejo-markdown-link-previews-concept

aschrijver commented 1 year ago

I should add that the OpenGraph issue is broader. Here's the organization account by the Pixelfed developer, and the description makes it look like this is Codeberg.

forgejo-opengraph-org-accounts

jolheiser commented 1 year ago

I should add that the OpenGraph issue is broader. Here's the organization account by the Pixelfed developer, and the description makes it look like this is Codeberg.

forgejo-opengraph-org-accounts

fwiw this looks like a byproduct of where it was posted, and would be remedied if they added an org description. On Discord, the OG embed for this org is blank, but in Matrix (where I'm assuming this was taken) it appears to try to use the site description as a fallback. On both platforms it uses the org description if available.