Omit OpenGraph/Twitter tags in redirected sign-in page
What does this MR do and why?
This MR introduces a condition for rendering OpenGraph and Twitter meta
HTML tags for sign-in page. If the sign-in page redirects after successful sign in, tags will be omitted. This results in social network sites, messengers, etc. to not show detailed link preview (or card) for non-publicly available GitLab page. The additional logic allows to generate preview for direct sign-in link.
Added tests for new helper method.
Related to Do not generate Twitter/OpenGraph meta tags on ... (#20026 - closed).
Screenshots or screen recordings
Telegram example.
before | after |
---|---|
How to set up and validate locally
- Sign out
- Visit the sign-in page http://127.0.0.1:3000/users/sign_in
- Observe OpenGraph (
property="og:*"
) and Twitter (property="twitter:*"
)meta
tags inhead prefix="og: *"
present. - Visit page that requires authorization (eg.: http://127.0.0.1:3000/gitlab-instance)
- Observe OpenGraph and Twitter
meta
tags inhead
missing.
Another option is to share abovementioned links in a messenger (eg.: Slack).
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.