Wakanda's avatar
Level 10

How to crawl slugs using spatie sitemap

Am using spatie sitemap to generate sitemap links using a command

public function handle()
    {
        // modify this to your own needs
        SitemapGenerator::create(config('app.url'))
            ->writeToFile(public_path('sitemap.xml'));
    }

This only generate links without slugs like home about and contact page

0 likes
7 replies
Sinnbeck's avatar

Are all of the links available by browsing from the front page? I mean without logging in and without needing to go to a "secret" page first

1 like
Wakanda's avatar
Level 10

@sinnbeck thanks for replying. The pages i am reffering to are outsitde the auth guard. And for example the home page is generated and homepage has some products that are not hidden and the package is not generating sitemap for such scenario.

Sinnbeck's avatar

Any chance you can share a link? Or is it local?

1 like
Sinnbeck's avatar

Can you should the rendered html of one of the items on the Frontpage, that it should be saving?

1 like
Wakanda's avatar
Level 10

@sinnbeck you know what just ran the command in production and its working like a charm, but in dev in was giving me a hard time

Sinnbeck's avatar

My guess is that it couldn't resolve the urls. Good to hear it's working there at least

1 like

Please or to participate in this conversation.