SEO for the OLPC wiki/sitemapgen: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 24: Line 24:
echo Archiving old sitemap... done
echo Archiving old sitemap... done


echo Cat'ing all of the name spaces ...
echo Cating all of the name spaces ...
cat sitemap-wikidb-NS_*.xml > sitemap.xml
cat sitemap-wikidb-NS_*.xml > sitemap.xml
echo Cat'ing all of the name spaces ... done
echo Cating all of the name spaces ... done




echo Replacing 'localhost' with wiki.l.o ...
echo Replacing localhost with wiki.l.o ...
sed -i 's,localhost,wiki.laptop.org,g' sitemap.xml
sed -i 's,localhost,wiki.laptop.org,g' sitemap.xml
echo Replacing 'localhost' with wiki.l.o ... done
echo Replacing localhost with wiki.l.o ... done


echo Cleaning that up ...
echo Cleaning that up ...
Line 45: Line 45:
echo Adding the XML headers back... done
echo Adding the XML headers back... done


echo Cleaning up the cat'd files ...
echo Cleaning up the catd files ...
rm sitemap-wikidb-NS*
rm sitemap-wikidb-NS*
echo Cleaning up the cat'd files ... done
echo Cleaning up the catd files ... done


echo Pinging the sitemap update to the search engines...
echo Pinging the sitemap update to the search engines...
Line 60: Line 60:
echo All done
echo All done
</pre>
</pre>

== Use ==

The guys over at [http://appropedia.org Appropedia] are using this script over at their wiki as well:
* http://forum.appropedia.org/blog/finally-working-mediawiki-sitemap


[[Category:Wiki gang]]
[[Category:Wiki gang]]

Latest revision as of 02:02, 27 August 2008

This is a script, that when run in the /maintainence folder of mediawiki, will:

  1. Use Mediawiki's built-in sitemapgenerator script
  2. Cat all of the files from each name space
  3. Change the URL's to match the wiki naming scheme
  4. Ping google, etc. that this has been done


#!/bin/sh
echo Sitemap script ...
cd /home/www/wiki.laptop.org/maintenance/
php-cgi generateSitemap.php
echo Sitemap script ... done

echo Moving files, un'gz'ing ...
mv -f *.gz ../
cd ..
gzip -d *.xml.gz
echo Moving files, un'gz'ing ... done

echo Archiving old sitemap...
mv sitemap.xml sitemap.xml.$(date "+%Y%m%d%H")
echo Archiving old sitemap... done

echo Cating all of the name spaces ...
cat sitemap-wikidb-NS_*.xml > sitemap.xml
echo Cating all of the name spaces ... done


echo Replacing localhost with wiki.l.o ...
sed -i 's,localhost,wiki.laptop.org,g' sitemap.xml
echo Replacing localhost with wiki.l.o ... done

echo Cleaning that up ...
sed -i "/?xml version/d" sitemap.xml
sed -i "/urlset/d" sitemap.xml
echo Cleaning that up ... done

echo Adding the XML headers back...
echo "</urlset>" >> sitemap.xml
sed -i '1i\
<?xml version="1.0" encoding="UTF-8"?>\
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' sitemap.xml
echo Adding the XML headers back... done

echo Cleaning up the catd files ...
rm sitemap-wikidb-NS*
echo Cleaning up the catd files ... done

echo Pinging the sitemap update to the search engines...
wget -q -O /dev/null http://www.google.com/webmasters/tools/ping?sitemap=http://wiki.laptop.org/sitemap.xml
wget -q -O /dev/null http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=http://wiki.laptop.org/site$
wget -q -O /dev/null http://submissions.ask.com/ping?sitemap=http://wiki.laptop.org/sitemap.xml
wget -q -O /dev/null http://api.moreover.com/ping?u=http://wiki.laptop.org/sitemap.xml
wget -q -O /dev/null http://webmaster.live.com/ping.aspx?siteMap=http://wiki.laptop.org/sitemap.xml
echo Pinging the sitemap update to the search engines... done


echo All done

Use

The guys over at Appropedia are using this script over at their wiki as well: