Hi EE Community Folks.
I find that 99% of the problems are caused by the user, this is probably no different but I am unable to pinpoint why I am unable to get a sitemap.xml file to render properly in a browser.
In the Template Manager, a template group called “docs”, I created an xml file called sitemap. So editing the file now called “sitemap.xml” (saving templates as actual files) I apply all the appropriate code to list site entries and other pages of the site dynamically, for example:
{exp:channel:entries
channel="about"
}
<url>
<loc><<the_url>>{url_title}</loc>
<lastmod>{edit_date format="%Y-%m-%d"}</lastmod>
<changefreq>yearly</changefreq>
0.6</priority>
</url>
{/exp:channel:entries}
and everything seems to work file when I use the proper method of accessing the page, http://url.tld/temp_group/temp_name. But if I add the “.xml” extension to the url, I get a 404 error.
I am of course assuming that Google webmaster and other sites of the like would not accept what renders without the “.xml” extension attached.
So I am not sure how to access the file as an actual xml file in order to submit the sitemap.
Am I missing a step and just not seeing it??
Thank you in advance! Eric
To confirm, in your template preferences, you changed the ‘type’ from ‘Web Page’ to ‘XML’ and you named your actual template ‘sitemap.xml’. Correct?
I’ve done the same numerous times with success. Here is what’s in my XML template
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
{exp:channel:entries channel="channel_name"}
<url>
<loc>https://www.domain.com/template_group/{url_title}</loc>
</url>
{/exp:channel:entries}
</urlset>
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.