-
Hi.
I created page ads.
And on this page i got content dynamicaly with fetch throw javascript from get parameter.
The single page for dynamic post look like this https://www.imprendocasa.it/ads/?id=604
fetch('my-site/api/realestate/v1/immobili/<?php echo $_GET['id']; ?>', {
method: 'GET',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'authkey': 'xxxx',
// 'appkey': 'xxx'
'appkey': 'xxx'
},
})
.then((resp) => resp.json())
.then((resp) => {
this.single = resp.data[0];
this.loading = false;
})
.catch(error => {
console.log(error, 'error from single immobile')
});
And i want to add those posts in sitemap.
I found 2 filters, but i can’t understand how them works.
add_filter('rank_math/sitemap/index', function ($xml) {
$xml .= '
<sitemap>
<loc>https://www.imprendocasa.it/ads-sitemap.xml</loc>
<lastmod>2021-09-14T20:34:15+20:00</lastmod>
</sitemap>';
return $xml;
}, 11);
add_filter('rank_math/sitemap/${type}/content', function () {
return '
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.imprendocasa.it/ads/?id=701</loc>
<lastmod>2020-09-14T20:34:15+00:00</lastmod>
</url>
</urlset>';
});For sitemap_index i have just page sitemap https://i.imgur.com/IPCAcrW.png
Thanks in advance.
The ticket ‘How to add dynamic post type in sitemap?’ is closed to new replies.