summaryrefslogtreecommitdiffstats
path: root/templates/base/head_opengraph.tmpl
Commit message (Collapse)AuthorAgeFilesLines
* Avoid unnecessary 500 panic when a commit doesn't exist (#28719)wxiaoguang2024-01-071-1/+1
| | | | | | | | | In #26851, it assumed that `Commit` always exists when `PageIsDiff==true`. But for a 404 page, the `Commit` doesn't exist, so the following code would cause panic because nil value can't be passed as string parameter to `IsMultilineCommitMessage(string)` (or the StringUtils.Cut in later PRs)
* Refactor `og:description` to limit the max length (#26876)wxiaoguang2023-09-031-5/+10
| | | | | | | | 1. The `og:description` should be "a one to two sentence description of your object" * It shouldn't output all the user inputted content -- it would be pretty huge. * Maybe it only needs at most 300 bytes. 2. Do not render commit message as HTML
* Improve opengraph previews (#26851)Linus Groh2023-09-011-0/+42
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.