Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7217963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:25:13+00:00 2026-05-28T21:25:13+00:00

How do I configure CFWheels to display the following XML at http://mydomain.com/sitemap.xml ? <?xml

  • 0

How do I configure CFWheels to display the following XML at http://mydomain.com/sitemap.xml?

<?xml version="1.0" encoding="UTF-8"?>
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      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">

      <-- I'll add the <url> tags dynamically here later -->
</urlset>

I’ve removed the “sitemap.xml” from the web.config file.

After this I’m not sure what to do about creating the controller and view. Should I create a “sitemap.xml” folder in the “views” folder, then add an “index.cfm” file and then add the XML above?

Should I create a “sitemap.xml.cfc” file in the “controllers” folder? And what should the controller file contain?

Should it look something like this?

<cfcomponent extends="Controller" output="false">
<cfscript>  
  function init(){
    // Let CFWheels know what type of output this controller can 'provide'
    provides("xml");
  }

  function index(){

  }
</cfscript>
</cfcomponent>

Do I need to add an entry to the routes.cfm?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T21:25:14+00:00Added an answer on May 28, 2026 at 9:25 pm

    Setting up the Controller

    Your controller’s index() method should look something like this. It’s stored at controllers/Sitemap.cfc.

    function init() {
        // Grab data about URLs from model or build an array of structs to pass to the view
        urls = model("page").findAll(); // This line is just an example
    
        // Call `renderWith()` to instruct Wheels that this requires a special content-type
        renderWith(urls);
    }
    

    Setting up the View

    Your view at views/sitemap/index.xml.cfm can then generate the required XML:

    <cfoutput>
    
    <?xml version="1.0" encoding="UTF-8"?>
    <urlset
        xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        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">
    
        #includePartial(partial="url.xml", query=urls)#
    </urlset>
    
    </cfoutput>
    

    Then you can implement a partial at views/sitemap/_url.xml.cfm representing a single item in your query or array. Let me know if you’re using something other than a query, and I can modify my example above.

    <cfoutput>
    
    <url>
        <loc>#arguments.uri#</loc>
        <loc>#arguments.updatedAt#</loc>
    </url>
    
    </cfoutput>
    

    Keep in mind that when you use a partial like this, query columns or struct keys get placed into the arguments scope, which is why I’m referencing arguments.uri and arguments.updatedAt in my fictitious example.

    Accessing via URL

    Depending on your server’s URL rewriting capabilities, you may need to try a couple things to get the URL to do what you want.

    You may be able to do something like this in config/routes.cfm (but I’ve only tested this on Apache):

    <cfset addRoute(pattern="sitemap.[format]", controller="sitemap", action="index")>
    <cfset addRoute(pattern="sitemap", controller="sitemap", action="index")>
    

    Then you can load the URL at http://www.example.com/sitemap.xml

    If that doesn’t work, try this:

    <cfset addRoute(pattern="sitemap.xml", controller="sitemap", action="index")>
    <cfset addRoute(pattern="sitemap", controller="sitemap", action="index")>
    

    Again, you can load the URL at http://www.example.com/sitemap.xml

    Finally, if that doesn’t work, remove the extra lines from config/routes.cfm and load this URL (which most definitely will always work regardless):

    `http://www.example.com/sitemap?format=xml`.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

configure scripts always include something like the following in the help message: ... By
How can I configure hibernate sessionFactory in Spring such that it uses the hibernate.cfg.xml
My configure.in file has LT_VERSION=1.1 . I am using the latest version of autoconf
I configure a flow in mule-config.xml based on the documentation( click here ). Here
I'm trying to configure an Apache webserver to work the following way: if /specialdir/
I configure qt-x11 with following options ./configure -prefix /iTalk/qtx11 -prefix-install -bindir /iTalk/qtx11-install/bin -libdir /iTalk/qtx11-install/lib
I am trying to configure the hibernate.cfg.xml file to use memcache. I see the
Trying to configure Zend_Cache_Backend_Memcached via a config.ini or config.xml file. I'm not sure how
I want to configure Kohana 2.x to have links in this format: http://localhost/mysite/web/admin/support instead
I am trying to configure postfix for using relay host with the following in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.