milesj / utility

[Deprecated] A CakePHP plugin for common utility classes.
MIT License
69 stars 24 forks source link

Sitemap returns nothing #9

Closed larry-tx closed 11 years ago

larry-tx commented 11 years ago

I've

Unfortunately, this is what is produced:

<response><name>Not Found</name><url>/sitemap.xml</url></response>

Can you give me any help with what I may be doing wrong?

milesj commented 11 years ago

You still have to provide the data for sitemap: milesj.me/code/cakephp/utility#sitemap-generation

It doesn't just generate it.

larry-tx commented 11 years ago

Do you mean something like this (found in my CollectionsController):

public function _generateSitemap() {
            $sitemap = array(
                array(
                    'loc' => array('controller' => 'collections', 'action' => 'index'),
                    'changefreq' => 'weekly',
                    'priority' => '0.5'
                )
            );
            if ($results = $this->Collection->find('all')) {
                foreach ($results as $result) {
                    $sitemap[] = array(
                        'loc' => array('controller' => 'collections', 'action' => 'view', $result['Collection']['slug']),
                        'lastmod' => $result['Collection']['modified'],
                        'changefreq' => 'weekly',
                        'priority' => '0.9',
                    );
                }
            }

            return $sitemap;

        }
milesj commented 11 years ago

Have you enabled routes?

CakePlugin::load('Utility', array('bootstrap' => true, 'routes' => true));

larry-tx commented 11 years ago

Here's what I've got; In bootstrap.php:

CakePlugin::load( array( 'Autocache', array('routes' => TRUE), 'UrlCache', 'Users.Users', array('routes' => TRUE), 'Acl.Acl', array('bootstrap' => TRUE), 'Utils.Sluggable', 'ClearCache', 'AclExtras', // 'DebugKit', 'Upload', 'Utility', array('bootstrap' => TRUE, 'routes' => TRUE), ) ); In core.php: Configure::write('debug', 0);...require_once dirname(__DIR__) . '/Vendor/autoload.php'; In CollectionsController.php public function _generateSitemap() { $sitemap = array( array( 'loc' => array('controller' => 'collections', 'action' => 'index'), 'changefreq' => 'weekly', 'priority' => '0.5' ) ); if ($results = $this->Collection->find('all')) { foreach ($results as $result) { $sitemap[] = array( 'loc' => array('controller' => 'collections', 'action' => 'view', $result['Collection']['slug']), 'lastmod' => $result['Collection']['modified'], 'changefreq' => 'weekly', 'priority' => '0.9', ); } } return $sitemap; }

Larry E. Lutz 2425 Sage Road, Apt. 53 Houston, TX 77056 (713) 850-1358 LarryTX@outlook.com

Date: Tue, 28 May 2013 15:45:41 -0700 From: notifications@github.com To: Utility@noreply.github.com CC: LarryTX@outlook.com Subject: Re: [Utility] Sitemap returns nothing (#9)

Have you enabled routes?

CakePlugin::load('Utility', array('bootstrap' => true, 'routes' => true));

— Reply to this email directly or view it on GitHub.

milesj commented 11 years ago

CakePlugin::load() is being used incorrectly. Try this:

CakePlugin::load( array( 
    'Autocache' => array('routes' => TRUE), 
    'UrlCache', 
    'Users.Users' => array('routes' => TRUE), 
    'Acl.Acl' => array('bootstrap' => TRUE), 
    'Utils.Sluggable', 
    'ClearCache', 
    'AclExtras', 
    // 'DebugKit', 
    'Upload', 
    'Utility' => array('bootstrap' => TRUE, 'routes' => TRUE)
) );
larry-tx commented 11 years ago

My bad, but unfortunately, even after changing the load directive as follows, sitemap still returns nothing: CakePlugin::load( array( 'Autocache' => array('routes' => TRUE), 'UrlCache', 'Users.Users' => array('routes' => TRUE), 'Acl.Acl' => array('bootstrap' => TRUE), 'Utils.Sluggable', 'ClearCache', 'AclExtras', // 'DebugKit', 'Upload', 'Utility' => array('bootstrap' => TRUE, 'routes' => TRUE) ) );

Larry E. Lutz 2425 Sage Road, Apt. 53 Houston, TX 77056 (713) 850-1358 LarryTX@outlook.com

Date: Tue, 28 May 2013 17:10:43 -0700 From: notifications@github.com To: Utility@noreply.github.com CC: LarryTX@outlook.com Subject: Re: [Utility] Sitemap returns nothing (#9)

CakePlugin::load() is being used incorrectly. Try this:

CakePlugin::load( array( 'Autocache' => array('routes' => TRUE), 'UrlCache', 'Users.Users' => array('routes' => TRUE), 'Acl.Acl' => array('bootstrap' => TRUE), 'Utils.Sluggable', 'ClearCache', 'AclExtras', // 'DebugKit', 'Upload', 'Utility' => array('bootstrap' => TRUE, 'routes' => TRUE) ) );

— Reply to this email directly or view it on GitHub.

milesj commented 11 years ago

I'm using the sitemap successfully in a few projects. I would suggest placing debug()s in your code and the Utility plugin to determine where the disconnect is.

From the looks of your opening post, it seems like a routing issue.

larry-tx commented 11 years ago

Unfortunately, I have already spent far more than the time I budgeted to get a sitemap working. At this point, I'm afraid, we'll have to do without the sitemap part of SEO. If I ever have tons of spare time with nothing to do, I'll tackle debugging it.

Larry E. Lutz 2425 Sage Road, Apt. 53 Houston, TX 77056 (713) 850-1358 LarryTX@outlook.com

Date: Tue, 28 May 2013 21:31:36 -0700 From: notifications@github.com To: Utility@noreply.github.com CC: LarryTX@outlook.com Subject: Re: [Utility] Sitemap returns nothing (#9)

I'm using the sitemap successfully in a few projects. I would suggest placing debug()s in your code and the Utility plugin to determine where the disconnect is.

From the looks of your opening post, it seems like a routing issue.

— Reply to this email directly or view it on GitHub.