seo – Embed sitemap in a page


I’ve seen that many sites have a dedicated page for a sitemap, not just an .xml file.

For example, They’re using Yoast SEO and sitemap.xml is also available, but how can you embed the whole sitemap in a page like this?

Is there a function or just a file_get_contents()?

in progress 0
HenrijsS 1 year 2022-01-06T04:58:24-05:00 0 Answer 0 views 0

Answer ( 1 )


    You can fetch all the different post_types you have by using get_post_types(). Then you can loop through all posts of each post_types and echo all these posts (title + link). That way you have the freedom of formatting your sitemap the way you want.

Leave an answer