sybrew/the-seo-framework

Site name is not displayed by Google + Schema.org: 'alternateName' is missing

Closed this issue · 7 comments

Describe the bug

Problem: Google refuse to display 'Site name' above the web address in search results.
This happens on almost all websites (8 websites) using this plugin.

I know that Google doesn't guarantee that Site name will be displayed but I start to thinking is not normal.

Google start to update how Site names are used (July 2023):
https://searchengineland.com/google-search-rolls-out-site-name-updates-and-workarounds-429979
We need to add 'alternateName':
https://developers.google.com/search/docs/appearance/site-names#workaround

BUT

something like this: "alternateName": ["BT", "B-T", "Burnt Toast Shop", "example.com"]
is completely missing even if the plugin promise to generate it since ver. 2.9.0, when Person or Organization is filled and is different from site name.

Expected behavior

We really need to output rich 'alternateName' AND with more then one alternative names, according to Google:
https://developers.google.com/search/docs/appearance/site-names#alternative

Can you have a look why it's not generated and add more options to add alternative names?
Also, any other ideas or bugs that can prevent to Google accept Site name?

Screenshots
Problem: Site name missing - web address is used instead
Snímek obrazovky 2024-02-02 v 21 15 35

We need it with Site name:
Snímek obrazovky 2024-02-02 v 21 18 00

Plugin should generate at least:
Snímek obrazovky 2024-02-02 v 21 15 50

We need more options like this in plugin:
Snímek obrazovky 2024-02-02 v 21 16 21

This feature was removed in TSF v5.0 unintentionally during the Structured Data rewrite.

If you wish to have this feature immediately, you can implement this filter:

add_filter( 'the_seo_framework_schema_graph_data', function( $graph ) {

	foreach ( array_column( $graph, '@type' ) as $id => $type ) {
		if ( 'WebSite' === $type ) {
			$tsf = tsf();

			$blog_name = $tsf->data()->blog()->get_public_blog_name();
			$alt_name  = $tsf->get_option( 'knowledge_name' );

			if ( strlen( $alt_name ) && $blog_name !== $alt_name )
				$graph[ $id ]['alternateName'][] = $alt_name;

			// Add more alternate names here:
			$graph[ $id ]['alternateName'][] = 'My Alternate Name 1';
			$graph[ $id ]['alternateName'][] = 'My Alternate Name 2';
		}
	}

	return $graph;
} );

So I send the alternateNames towards Google. I'll let you know if it helped. Thank you so much for your support!

Hello!

I'm afraid it didn't help for you. Still, I'm going to implement this in 5.0.5, after which you can remove the snippet above from your website.

I recommend writing "Webia" in a <h1> tag where your logo is now, as a sibling of the <figure>.
e.g.

<!-- Figure element content -->
</figure>
<h1 id=header-site-name>Webia</h1>

You can hide the text using CSS -- this is a "screen reader text" trick, so the text will be copyable when someone selects the title, and it will be readable by those who use visual aid tools and search engine spiders:

#header-site-name {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}

To learn more, please see https://developers.google.com/search/docs/appearance/site-names. Edit: You already linked to this earlier.

Hello,
No, the alternateNames have not helped on any of my sites (in five weeks).
Google still refuses to show "site name" on almost all sites (8 sites) using this plugin.

Can you please confirm which <h1> placement strategy you recommend as you recommend wrapping earlier: https://wordpress.org/support/topic/site-name-is-not-displayed-by-google-schema-org-alternatename-is-missing/.

To wrap an image in an <h1> element like this:

<h1>
     <figure>
        <a href="/"><img><span id="site-title" aria-hidden="true">Site Title Here</a>
     </figure>
</h1>

Or better yet:

<figure>
      <img>
</figure>
<h1 id="site-title" aria-hidden="true">Site title here</h1>

Thank you!

I recommend the second and have the <a> tag wrap around both the text and figure.

Thank you! Do you think that <figure> is somehow important or can it be a <div> or just an <img> if it's still a sibling right before <h1>?

<figure> has a semantic meaning that allows for captioning, while <div> practically says, "I'm a division of whatever."

Do what's most logical for the user. If <figure> isn't helpful in the context, you can fall back to <div>.

I don't think search engines would care. But for users, since it's the site title in screen-reader format, I do not believe <figure> needs to be semantically announced. So, I'd go for <div>.

We use this:

<header ...>
	<div ...>
		<div ...>
			<h1 ...>
				<a href="https://theseoframework.com/" translate="no">
					<svg ...><!-- SVG here --></svg>
					The SEO Framework
				</a>
			</h1>
		</div>
		<div ...>
			<!-- Widgets here -->
		</div>
	</div>
</header>

And that works perfectly well. You can swap the h1 and a tags if you'd like.