how to add urls dynamically into the sitemap

I basically want to add such urls to my existing sitemap index. I'm currently using WP SEO by yoast, but I'm open to trying out alternative plugins. My urls are currently like this...

e.g  www.mysite.com/used-cars/location/paris/model/bmw-m3

                     

     www.mysite.com/used-cars/model/bmw-m3

I want to have all these kind of urls in a loop, then push them into a sitemap.

How can I do this?

Topic sitemap plugin-wp-seo-yoast google-xml-sitemaps Wordpress

Category Web


Looks like one of those is the canonical URL, can you take a look at the page source and check if is there a canonical tag?

    <link rel="canonical"...

Also there is a setting in yoast for the sitemap https://kb.yoast.com/kb/how-to-customize-the-sitemap-index/ and you can add your own sitemap too: https://kb.yoast.com/kb/add-external-sitemap-to-index/

Note: Duplicate content will harm your SEO ranking

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.