Simple way to unset the URL link is alter simple sitemap module, here we will give an example of code for remove or unset any link on any condition basis.
Example:
Create a custom module or put the code in existing custom module.
a. First render class library in file header.
use Drupal\simple_sitemap\Simplesitemap;
b. Then write the hook function code.
/**
* Alter the generated link data before the sitemap is saved.
* This hook gets invoked for every sitemap chunk generated.
*
* @param array &$links
* Array containing multilingual links generated for each path to be indexed.
*/
function finder_simple_sitemap_links_alter(&$links) {
// Remove french URL for a certain path in the hreflang sitemap.
foreach ($links as $key => $link) {
if ($link['path'] === 'node/1') {
// Remove 'loc' URL if it points to a french site.
if ($link['langcode'] === 'fr') {
unset($links[$key]);
}
// If this 'loc' URL points to a non-french site, make sure to remove
// its french alternate URL.
else {
if ($link['alternate_urls']['fr']) {
unset($links[$key]['alternate_urls']['fr']);
}
}
}
}
}