themes icon indicating copy to clipboard operation
themes copied to clipboard

Blockbase: Duplicate Title tag on all blockbase & blockbase-premium themes

Open rachelwinspear opened this issue 4 years ago • 16 comments

Quick summary

Any new site created has duplicate <title> tags, regardless of plan. Only happens on child themes of blockbase or blockbase-premium.

Steps to reproduce

  1. Create a new Simple site (Free or Pro Plan)
  2. Pick any theme (Free or Premium)
  3. Check the page source. You will see two <title> tags.

What you expected to happen

I would expect the <title> to be shown once in the page source code - as showing twice could have an impact on SEO.

What actually happened

The <title> is shown twice, which does not happen with themes like Hever or Twenty-TwentyTwo.

Context

User is worried about SEO impact. 4848257-zen

Simple, Atomic or both?

Both

Theme-specific issue?

Any themes that are children of blockbase or blockbase-premium

rachelwinspear avatar Mar 10 '22 16:03 rachelwinspear

Thanks @rachelwinspear! This issue has been triaged as I was able to reproduce this on an Atomic test site with the Premium theme: Baxter. I was also able to reproduce this on an Atomic site with the free New Themes: Attar, Hari, Marl, Winkel, and Dorna

kimerlin81 avatar Mar 10 '22 20:03 kimerlin81

I think creating a child theme to customize header.php as suggested in the ticket is not possible for Block themes. Block themes do not have PHP files.

@kimerlin81 Are there any other workarounds at the moment?

devNigel avatar Mar 11 '22 03:03 devNigel

Asking here: p1646979508429909-slack-C029FM1EH

Robertght avatar Mar 11 '22 06:03 Robertght

@Robertght the link appears to be incorrect.

devNigel avatar Mar 11 '22 06:03 devNigel

The issue was still present when a different SEO plugin was active. Updated the linked thread (it's working ok here, @devNigel!) and asked the customer to confirm the name and version number to help testing.

inaikem avatar Mar 18 '22 07:03 inaikem

Customer came back with the following information:

Rank Math, and I forgot the other one I tested, but both of them gave the same issue.

kylemcph avatar Mar 18 '22 08:03 kylemcph

@Automattic/serenity is this something that can be added to your board (as per p1647611540333819/1646979508.429909-slack-C029FM1EH)?

zdenys avatar Mar 26 '22 15:03 zdenys

I am able to replicate this issue on a self-hosted ( TasteWP instance ) with Blockbase theme. So it looks like the issue is rooted in Blockbase

nagpai avatar Apr 09 '22 14:04 nagpai

Should we change the priority to high, since this will affect SEO of a very large number of websites?

nagpai avatar Apr 09 '22 14:04 nagpai

I compared the functions.php of TwentyTwentyTwo with that of Blockbase.

I see that Blockbase seems to have a line with the template tag add_theme_support( 'title-tag' );

From what I read, this line is redundant in block themes, since Gutenberg has this built-in feature of adding the title tag. ( I found this link via this forum discussion search result.

There may be some other reason why we still have add_theme_support( 'title-tag' ); added on Blockbase, which needs to be discussed with the theme team. If there is none, then that line should be removed.

I confirm the following

  1. The issue of duplicate tags gets introduced in TwentyTwentyTwo theme if we add the line discussed above.
  2. the issue goes away from Blockbase if we remove / comment off the line.

nagpai avatar Apr 10 '22 07:04 nagpai

Workaround - I tested this code snippet, that seems to do the job for now ( designed to work only with Blockbase child themes )

function blockbase_remove_duplicate_title_tag_nrmn () {
	
	if (  ! wp_is_block_theme() ) {
		return;
	}	
	
	remove_theme_support( 'title-tag' );	
}

add_action( 'after_setup_theme', 'blockbase_remove_duplicate_title_tag_nrmn', 10 );

nagpai avatar Apr 10 '22 08:04 nagpai

The title-tag support was added here. It probably needed it back then and core caught up with that and now it's redundant. I vote to remove.

MaggieCabrera avatar Apr 12 '22 15:04 MaggieCabrera

I've just been testing Blockbase with and without the title-tag support and I saw no differences - the title tag still rendered correctly either way. I also tested with Yoast and I can see that removing the title-tag support fixes the duplication issue, so I think removing this sounds good to me too.

mikachan avatar Apr 12 '22 15:04 mikachan

Delayed reaction, but yes, Serenity can pull this in on our next sprint. 😄

blackjackkent avatar Apr 13 '22 20:04 blackjackkent

Just wanted to add that this issue popped up on another blockbase child theme "Russel" here: 5164173-zd-woothemes

I provided @nagpai 's code snippet above as a temporary workaround which seemed to remove the duplicate <title> tag.

aisajib avatar May 02 '22 20:05 aisajib

Worth mentioning that I'm seeing duplicate title tags even without Yoast.

I also see it on a Simple site with the Pro Plan and I see it on a Simple Free site. Doesn't seem to matter which theme.

image

I'm also still seeing the duplicate title tags even with add_theme_support( 'title-tag' ); commented out 🤔

markbiek avatar May 17 '22 13:05 markbiek