Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve opengraph previews #26851

Merged
merged 5 commits into from Sep 1, 2023

Conversation

linusg
Copy link
Contributor

@linusg linusg commented Aug 31, 2023

Add more useful Open Graph metadata for commit and file URLs:

  • Set og:title to the page title, which is a concise summary in both cases (<commit message> · <commit hash> and <filename> at <branch>, respectively)
  • Set og:description to the commit message body, if available
  • Set og:url to the relevant URLs instead of the repo URL

Also move the relevant meta tags into a separate template as they now take up the majority of the base head template.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 31, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 31, 2023
@techknowlogick techknowlogick added type/enhancement An improvement of existing functionality type/refactoring Existing code has been cleaned up. There should be no new functionality. labels Sep 1, 2023
Copy link
Member

@delvh delvh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template refactor was overdue, and the rest looks good too.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Sep 1, 2023
@delvh
Copy link
Member

delvh commented Sep 1, 2023

@puni9869 that will be a bit hard in this case as og:<…>-headers simply change what external links can display when you link to a website.
However, every app is free to create their own display, there is no standard on how this information will be displayed.
We simply provide the information for others.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Sep 1, 2023
@techknowlogick techknowlogick enabled auto-merge (squash) September 1, 2023 14:59
@techknowlogick techknowlogick added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Sep 1, 2023
@puni9869
Copy link
Member

puni9869 commented Sep 1, 2023

🚀

@techknowlogick techknowlogick merged commit 5743d7c into go-gitea:main Sep 1, 2023
24 checks passed
@GiteaBot GiteaBot added this to the 1.21.0 milestone Sep 1, 2023
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Sep 1, 2023
@linusg linusg deleted the improve-opengraph-previews branch September 1, 2023 19:14
zjjhot added a commit to zjjhot/gitea that referenced this pull request Sep 4, 2023
* giteaofficial/main:
  [skip ci] Updated licenses and gitignores
  Update documents to fix some links (go-gitea#26885)
  clarify aspects of the dump command (go-gitea#26887)
  Relocate the `RSS user feed` button (go-gitea#26882)
  Use Go 1.21 and update dependencies (go-gitea#26878)
  Update docs about attachment path (go-gitea#26883)
  Refactor "shortsha" (go-gitea#26877)
  Fix wrong review requested number (go-gitea#26784)
  Refactor `og:description` to limit the max length (go-gitea#26876)
  Reorder blocks in vue SFCs (go-gitea#26874)
  Make it posible to customize nav text color via css var (go-gitea#26807)
  Enable djlint H008 and fix issues (go-gitea#26869)
  Improve opengraph previews (go-gitea#26851)
  Add more descriptive error on forgot password page (go-gitea#26848)
  Allow users with write permissions for issues to add attachments with API (go-gitea#26837)
  Move licenses.txt to /assets directory (go-gitea#26866)

# Conflicts:
#	templates/base/footer_content.tmpl
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Dec 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/enhancement An improvement of existing functionality type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants