1

I have a website build in Angular 8, which among other things has a blog section. I have a sitemap.xml file that contains all the pages except the blog. The blog is created on WordPress so in order to get the posts, I invoke the WordPress API, show the HTML content and construct the URL by the given slug.

For example: WordPress blog: https://my-blog.example/2021/07/23/a-new-story/
after being parsed on my site: https://my-site.example/blog/a-new-story

How can I add the blog pages on the sitemap.xml, given that the origin of the pages is on WordPress, so crawlers can access them?

1
  • An XML sitemap is not sufficient to get your blog crawled and indexed. You need to link to each of your blog post from other places on your site. By default WordPress creates such links from the main page and by using tags and categories. Jul 26, 2021 at 15:52

2 Answers 2

2

Just adding https://my-site.example/blog/ to your https://my-site.example/sitemap.xml will work and google will catch the URLs.

Another way:

Put a https://my-site.example/blog/sitemap.xml file/url in your main https://my-site.example/sitemap.xml and add that file inside your WordPress blog, make sure the URLs in sitemap under blog directory has your main domain's https://my-site.example/xyz URLs.

0

The WordPress API has a ListPosts method. You could generate an XML sitemap by using that API to lists all the blog posts on WordPress.

I would create a cron job to generate a sitemap for your blog nightly. Your site can have multiple sitemaps. In this case it would make sense to have a separate sitemap for the blog like (/blog-sitemap.xml) and then list both your sitemaps in your robots.txt file or submit them both to search engines via your webmaster accounts.

Just listing all the blog pages in an XML sitemap will get them crawled, but it probably won't get them all indexed. Without any links to them, they won't rank well even if they are indexed. See The Sitemap Paradox. You need to create links into each blog post from somewhere else on your site.

If you were fulling using WordPress rather than just its API, it would do this for you. WordPress creates pages that list your posts and allows you to tag and categorize your posts in ways that link your blog posts to each other. For SEO it would be best to replicate some of this functionality from WordPress on your site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.