Skip to content

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
image image

How to set up and validate locally

  1. Sign out
  2. Visit the sign-in page http://127.0.0.1:3000/users/sign_in
  3. Observe OpenGraph (property="og:*") and Twitter (property="twitter:*") meta tags in head prefix="og: *" present.
  4. Visit page that requires authorization (eg.: http://127.0.0.1:3000/gitlab-instance)
  5. Observe OpenGraph and Twitter meta tags in head 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.

Merge request reports

Loading