Åbn dit websteds aktuelle wp-tema (barn) fil functions.php og tilføj næste kode dertil:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | add_filter('wpseo_sitemap_index', function () { $links = [ 'https://mysite.com/link1', 'https://mysite.com/link2', 'https://mysite.com/link3', 'https://mysite.com/link4', 'https://mysite.com/link5' ]; //also you can generate links by your own business logic $appended_text = ''; foreach ($links as $l) { $appended_text .= "<sitemap><loc>{$l}</loc></sitemap>"; } return $appended_text; }); |
I række $links sæt dine links, du vil tilføje til sitemap. Hvis du er udvikler, kan du tilføje din egen logik til at generere links.
Læs også om WooCommerce Products filtermodul 'SEO URL anmodning'