Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h1 duplicate error, but nothing in source code #530

Open
aschmutt opened this issue Apr 4, 2023 · 7 comments
Open

h1 duplicate error, but nothing in source code #530

aschmutt opened this issue Apr 4, 2023 · 7 comments

Comments

@aschmutt
Copy link

aschmutt commented Apr 4, 2023

  • [ x] I've read and understood the contribution guidelines.
  • [ x] I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

In Backend I click on "SEO needs improvement" and I get the H1 duplicate warning. But on the page, there is just one H1 as it should be:
https://www.leuphana.de/studium.html

Single title: H1s should only be used as your main title. Find all H1s in your text that aren't your main title and change them to a lower heading level!

Please describe what you expected to happen and why.

The H1 warning shall only be displayed, if more than one H1 in source code

How can we reproduce this behavior?

  1. Go to https://www.leuphana.de/studium.html
  2. Check Source Code for h1 => there is just one
  3. In Backend I can see the H1 warning in the SEO block

Screenshots

Bildschirmfoto 2023-04-05 um 00 02 40

Additional context

Is there maybe some kind of caching involved, so the result is not updated?

Technical info

  • TYPO3 version: 10.4
  • Yoast SEO version: yoast_seo_premium 5.1.1
  • Relevant extensions in case of a bug:
@aschmutt
Copy link
Author

aschmutt commented Apr 4, 2023

We updated to yoast_seo_premium 5.3.0 on a dev server, the bug is still the same

@vnc-kber
Copy link

Any update to this problem? We face it in all our typo3 systems as well.

@fgerards
Copy link

for me, this false positive is solved with the yoast_seo v9.0.0

@vnc-jboe
Copy link

vnc-jboe commented Jul 7, 2023

Updated to yoast_seo 9.0.1 and the problem still exists on all typo3 systems

@saitho
Copy link

saitho commented Sep 28, 2023

We also have this issue. It happens when there is content before the first h1.
In our case it's a breadcrumb navigation. But also empty <a> tags seem to be a problem, i.e. the <a id="c123"></a> jumpmarks of TYPO3 content elements.

I moved the marker after the headline, and the breadcrumb navigation below the content and moved it up via CSS.
The first is fine, the latter is not, as this works against the principles of designing HTML pages.

I'd love to provide a fix for this, but I have no clue how to compile JS sources in this project.

@helsner
Copy link
Contributor

helsner commented Nov 23, 2023

same issue for us on latest state/version

@georgringer
Copy link
Contributor

thanks a lot for the hint. I am xclassing the previewservice and move everything before the h1 to the end. this might not fit for you but maybe gives you an idea

<?php

declare(strict_types=1);

namespace StudioMitte\Theme\XClass\YoastSeo;

use YoastSeoForTypo3\YoastSeo\Service\PreviewService;

class XclassedPreviewService extends PreviewService {


    protected function prepareBody(string $body): string
    {
        $body = parent::prepareBody($body);

        $pos = strpos($body, '<h1');
        if ($pos !== false) {
            $firstPart = substr($body, 0, $pos);
            $body = substr($body, $pos) . $firstPart;
        }
        return trim($body);
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants