Laravel dynamic sitemap help?

Author
Camila Cruz Author
|
1 day ago Asked
|
1 Views
|
1 Replies
0

Hey everyone,

I'm pretty new to Laravel development and trying to get my head around SEO best practices, specifically for sitemaps. I'm working on implementing a dynamic sitemap for my Laravel application, aiming for something auto-updating and future-proof. I've been looking into solutions like 'Dynamic XML Sitemap for Laravel & All Websites' to make sure I'm doing it right.

I'm running into an issue where my dynamic sitemaps don't seem to be updating new content automatically, or perhaps I'm misconfiguring something basic. For example, after adding a new blog post, the sitemap doesn't reflect it even after running the update command. It seems to be caching old data or not recognizing new entries.

Here's a snippet of what I'm seeing after running my sitemap generation command, even when I know new content has been added:

$ php artisan sitemap:generate
[2023-10-27 14:45:01] local.INFO: Sitemap generation started.
[2023-10-27 14:45:02] local.INFO: Processing static routes... (5 URLs)
[2023-10-27 14:45:03] local.INFO: Processing dynamic models... (Posts: 120, Products: 80)
[2023-10-27 14:45:04] local.INFO: Sitemap updated successfully. Total URLs: 205.

// After adding a new post, running the command again shows the same 'Total URLs: 205'.
// It's not picking up the new content.

Any tips on debugging this, or common mistakes beginners make when setting up a Laravel sitemap?

1 Answers

0
Raj Mehta
Answered 16 minutes ago

The issue of your dynamic sitemap not updating new content, even after running the generation command, is typically due to caching. Ensure you clear all relevant cachesโ€”php artisan cache:clear, any package-specific sitemap cache, and verify your content queries are fetching fresh dataโ€”to ensure your Dynamic XML Sitemap for Laravel & All Websites (Auto-Updating & Future-Proof), or similar solutions like Spatie's laravel-sitemap, correctly reflect new content for optimal crawl budget. Hope this helps your conversions!

Your Answer

You must Log In to post an answer and earn reputation.