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

sitemap.xml has too many homepage references #33

Closed
benwellby opened this issue Sep 21, 2018 · 13 comments
Closed

sitemap.xml has too many homepage references #33

benwellby opened this issue Sep 21, 2018 · 13 comments

Comments

@benwellby
Copy link

We have installed the SEO Pro addon, everything is working great! However, the generated sitemap.xml outputs ~50 references to the homepage…

// this URL block is repeated ~50 times
<url>
    <loc>http://thoughtandmortar.local/</loc>
    <lastmod>2018-05-15</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.5</priority>
</url>

(Also tested on our 'live' server, same result)

In the addon settings, under Tools > SEO Pro > Site Defaults, I have disabled SEO Pro for any Collection that does not directly output it's own page/URL, which did not change the output.

All other page/URL references in the generated sitemap.xml a correct.

Has anyone else encountered this, or have any bright ideas on a possible fix?

:)

@jimblue
Copy link

jimblue commented Sep 26, 2018

Same problem here!

@benwellby
Copy link
Author

@jimblue

I have also posted this topic on the forum at Statamic.

https://statamic.com/forum/3627-seo-pro-sitemap-xml-has-too-many-homepage-references

I will post back here if there is a response.

@moritzstuker
Copy link

Same here. Any update on this?

@nvmpy
Copy link

nvmpy commented Oct 9, 2018

Are these homepage references just Entries within a Collection that has no route set, maybe?

return $this->data->merge([
'compiled_title' => $this->compiledTitle(),
'canonical_url' => $this->model->absoluteUrl(),
'home_url' => URL::makeAbsolute('/'),
'humans_txt' => $this->humans(),
'locale' => $this->locale(),
'alternate_locales' => $this->alternateLocales(),
'last_modified' => $this->lastModified(),
])->all();
}

canonical_url is populated via:

    /**
     * Get the full, absolute URL
     *
     * @return string
     */
    public function absoluteUrl()
    {
        return URL::makeAbsolute(
            URL::prependSiteUrl($this->uri(), $this->locale()),
            $this->locale()
        );
    }

where $this->uri() is null if there's no route set.

@jasonvarga
Copy link
Member

Yeah, it's fixed in develop, gonna make a release today probably.

@jasonvarga
Copy link
Member

This issue is most likely caused by a collection without a route.

For each of those collections you don't need URLs for, go into SEO Pro > Section Defaults > Your Collection then flick the sitemap enabled toggle.

@benwellby
Copy link
Author

Thank you @jasonvarga

I can confirm downloading the latest version of SEO Pro solves the issue.

Perfect!

@benwellby
Copy link
Author

There is still a slight issue…

I can't exclude a collection from both a generated sitemap 'and' the SEO Pro reports.

When setting a default for a section, let's call it "My Collection":

SEO Pro > Section Defaults > My Collection

I can't disable a section 'and' exclude it from the sitemap at the same time. This means a Collection Default is either enabled and the sitemap excluded, or disabled with the sitemap enabled.

Both can be on at the same time, but not off.

@benwellby
Copy link
Author

Is anyone else experiencing this… in Section defaults, not being able exclude a collection from both a generated sitemap 'and' the SEO Pro reports?

@jackmcdade
Copy link
Member

jackmcdade commented Oct 25, 2018

Are you running 2.10.7 and SEO Pro 1.1? I believe that's fixed now.

@benwellby
Copy link
Author

Just tested this with both of the updates (although SEO Pro was version 1.1.1).

No joy. Can't have both excluded from reports and sitemap :(

jasonvarga added a commit that referenced this issue Oct 29, 2018
…'t be in the sitemap either.

Fixes #33 even better.
@jasonvarga
Copy link
Member

Just released 1.1.2 which fixes this.

@benwellby
Copy link
Author

That did fix it @jasonvarga.

The sitemap.xml outputs only pages and collections as specified, and reports are now accurate.

When the Section Default is disabled the sitemap options still show as enabled. Functionally this change works, but could have a slightly improved UX (by disabling sitemap options too).

Great work chaps.

Thanks

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

6 participants