Next: Moving from Test or Development to Production UP: TOC
In addition to our desktop sitemap we will create a mobile sitemap.
In the existing model file /usr/local/www/logikfabrik.com/cakephp/app/Model/Sitemap.php
we add this function
We would like to call the functionality for sitemap creation from the command line. Therefore we need in CakePHP a Shell. Shells are in the subdirectory .../Console/Command/ and must end with "Shell.php".
vi /usr/local/www/logikfabrik.com/cakephp/app/Console/Command/LShell.php
Add the function call in LShell.php as follow
Sitemap->createSitemapDesktop(); $this->out(print_r($sm, true)); $sm = $this->Sitemap->createSitemapMobile(); $this->out(print_r($sm, true)); } } ?>
Use this command to run the shell:
/usr/local/bin/php -f /usr/local/www/logikfabrik.com/cakephp/app/Console/cake.php \ l createsitemap -app /usr/local/www/logikfabrik.com/cakephp/app
the shell gives this output:
Welcome to CakePHP v2.6.2 Console
---------------------------------------------------------------
App : app
Path: /usr/local/www/logikfabrik.com/cakephp/app/
---------------------------------------------------------------
Lets check the mobilesitemap.xml file:
cat /usr/local/www/logikfabrik.com/cakephp/app/webroot/sitemap.xml
http://www.logikfabrik.com/books/1/Rapid Application Development with Open Source Software
monthly
1.0
To finish we need to talk to the search robots. We tell them the name of the sitemap file
vi /usr/local/www/logikfabrik.com/cakephp/app/webroot/robots.txt
#ganze Website freigeben
User-agent: *
Disallow:
Disallow: /admin/
# url to the sitemap file:
Sitemap: http://www.logikfabrik.com/sitemap.xml
Sitemap: http://www.logikfabrik.com/mobilesitemap.xml
Lastly we need to check if our sitemap is a valid xml file. Therefore we will use free online services such as sitemapinspector.com.
Next: Moving from Test or Development to Production UP: TOC