Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.39k stars 1.98k forks source link

Remove OpenGraph metadata tags from "Coming Soon" sites #92385

Open gamebits opened 1 month ago

gamebits commented 1 month ago

What

If a wpcom site is marked as "Coming Soon", it should output no OpenGraph tags that social media sites can use to generate thumbnails, descriptions, and other previews of the site.

Judging by https://github.com/Automattic/wp-calypso/issues/56779#issuecomment-1230048770, I presume the current behavior is expected, and that a site should instead be set to "Private" to remove this metadata. Hence I'm submitting this as an enhancement and not a bug.

Why

The front page of a site that is marked as "Coming Soon" still has all the metadata loaded necessary for Slack and Twitter to generate previews of the full site. Here are the OG tags of one such site marked "Coming Soon" with Yoast (wordpress-seo) installed and active:

    <meta property="og:locale" content="en_US" class="yoast-seo-meta-tag"/>
    <meta property="og:type" content="website" class="yoast-seo-meta-tag"/>
    <meta property="og:title" content="Home - by Nijaeri" class="yoast-seo-meta-tag"/>
    <meta property="og:description" content="Who am I? “Zim, Zima, who got de keys to my bimma?” Well, lol, I’m not Beenie Man. My name is Nijaeri (Nigh-jair-ree). It’s an African American variation of the African name Njeri, and so far, it is 100% unique to me!" class="yoast-seo-meta-tag"/>
    <meta property="og:url" content="https://bynijaeri.com/" class="yoast-seo-meta-tag"/>
    <meta property="og:site_name" content="by Nijaeri" class="yoast-seo-meta-tag"/>
    <meta property="article:modified_time" content="2024-06-04T00:16:07+00:00" class="yoast-seo-meta-tag"/>
    <meta property="og:image" content="https://bynijaeri.com/wp-content/uploads/2024/05/about-nj-1.png" class="yoast-seo-meta-tag"/>
    <meta name="twitter:card" content="summary_large_image" class="yoast-seo-meta-tag"/>

Without Yoast:

            <meta name="description" content="Who am I? “Zim, Zima, who got de keys to my bimma?” Well, lol, I’m not Beenie Man. My name is Nijaeri (Nigh-jair-ree). It’s an African American variation of the African name Njeri, and so far, it is 100% unique to me! Read About https://open.spotify.com/artist/4iHNK0tOyZPYnBU7nGAgpQ?si=A3hldOKJQVGe65vMWJFfsA https://open.spotify.com/track/4EI8VuxUuIHKfafU72emqz?si=71b0e3ae964b4268 R&amp;B Memoirs R&amp;B Memoirs View all Posts Be the&hellip;" />

<!-- Jetpack Open Graph Tags -->
<meta property="og:type" content="website" />
<meta property="og:title" content="by Nijaeri" />
<meta property="og:description" content="Music and life those are my genres" />
<meta property="og:url" content="https://bynijaeri.com/" />
<meta property="og:site_name" content="by Nijaeri" />
<meta property="og:image" content="https://bynijaeri.com/wp-content/uploads/2024/05/about-nj-1.png" />
<meta property="og:image:width" content="378" />
<meta property="og:image:height" content="567" />
<meta property="og:image:alt" content="" />
<meta property="og:locale" content="en_US" />
<meta name="twitter:text:title" content="Home" />
<meta name="twitter:image" content="https://bynijaeri.com/wp-content/uploads/2024/05/about-nj-1.png?w=640" />
<meta name="twitter:card" content="summary_large_image" />

How

The site's settings:

by-nijaeri-settings

by-nijaeri-wpcom

Excerpts of how it appears on Slack and Twitter:

by-nijaeri-slack

by-nijaeri-twitter

mrfoxtalbot commented 1 month ago

Great catch @gamebits!

I can reproduce it on simple and on AT. Could someone in @Automattic/t-rex or @Automattic/lego take a look at this? Thank you!