WordPress/gutenberg-starter-theme

Wrong condition in header.php for `site-title`

audrasjb opened this issue · 3 comments

Hi,

Thanks a lot for this theme. I'm forking it for personal purposes, and I found a mistake related to site-title in header.php.

Nothing can meet the condition below:

if ( is_front_page() && is_home() )

A page can meet both conditions. If the settings under Settings->Reading->Your homepage displays are left at default, the home page will return true for both is_front_page() and is_home()

This is done for SEO purposes, so the H1 tag isn't used twice on a page. Whenever posts are shown on the front page, the site title is an H1 tag. If your blog isn't the front page, an H1 tag is used with this code:

if ( is_home() && ! is_front_page() ) :
    ?>
    <header>
        <h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
    </header>
    <?php
endif;

Hi and thanks for your answer @nate-allen :)

I know it's good for SEO but this is not what I meant with this issue.
See the changes I made in the related PR (#75):
https://github.com/WordPress/gutenberg-starter-theme/pull/75/files

Thanks,
Jb

@audrasjb Hmm, I don't think this is a bug though. You said:

Nothing can meet the condition below:

if ( is_front_page() && is_home() )

But the default settings (Your homepage displays your latest posts) would meet those conditions.