We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

XML page does not seem to render (a sitemap) in browser

How Do I?

iameric's avatar
iameric
48 posts
8 years ago
iameric's avatar iameric

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

       
Jeremy S.'s avatar
Jeremy S.
353 posts
8 years ago
Jeremy S.'s avatar Jeremy S.

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>
       
iameric's avatar
iameric
48 posts
8 years ago
iameric's avatar iameric

Hi Jeremy,

Thank you for the replay, and apologies for the late response…

I did create it as an xml page, did NOT name it with the xml extension… that seems key - thanks for the tip!!!!

Best Regards, Eric

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.