sitemap_xml
  • Hi,

    I'm having some problems with the default sitemap functionality. Namely, it doesn't seem to work.

    The default route is uncommented:


    $route['default_controller'] = 'fuel/page_router';
    $route['404_override'] = 'fuel/page_router';
    $route['translate_uri_dashes'] = FALSE;

    /*
    | Uncomment this line if you want to use the automatically generated sitemap based on your navigation.
    | To modify the sitemap.xml, go to the views/sitemap_xml.php file.
    */
    $route['sitemap.xml'] = 'sitemap_xml';
    $route['news|news/(:any)$'] = 'blog/$1';

    include(MODULES_PATH.'/fuel/config/fuel_routes.php');


    The sitemap_xml is unmodified but this route returns 404. Is there anything else that needs to be modified to enable the sitemap?

    Regards,
  • Do you have a fuel/application/views/sitemap_xml.php file that should have come with the default installation? Or do you have a sitemap.xml set in your CMS?
  • Yes, the default sitemap_xml.php is present and unmodified. No sitemap.xml in the CMS. Is this an additional requirement? I can't find any reference to it.
  • The code in the sitemap.xml is an example that is looking for a $nav array in the fuel/application/views/_variables/nav.php (http://docs.getfuelcms.com/general/navigation) and/or any modules that have preview_path setup and an associated page on the site. You could alternatively try changing line 16 to include all pages which would be those defined in the CMS, view files and modules (may be more then you want):
    $modules = $CI->fuel->pages->options_list('all', FALSE, FALSE);
  • It feels more like the issue is something to do with the routing. I'm not convinced it's routing to the sitemap_xml.php at all. I've adjusted the show_404() to echo "1" and still get a 404 back.

    Any other thoughts?
  • Is your "fuel_mode" set to "auto" in fuel/application/config/MY_fuel.php? Also, are other static view files showing up (e.g. does fuel/application/views/test.php show up at http://localhost/test)?
  • Ah, nailed it. Fuel mode was set to 'cms'. Changed to auto and it's routing correctly now.

    Thanks!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!