Use the shell to quickly generate a sitemap map file in XML format, which is suitable for small and medium sized websites. In this case, a sitemap file with 12,053 URLs is generated and only spents 4.3 seconds! The shell code is as follows:
Copy Code code as follows:
Cat Sitemap.txt|awk ' begin{print ' <?xml version=\ "1.0\" encoding=\ "utf-8\"?>\n<urlset> "}{print" <url >\n<loc> "$" </loc>\n<lastmod>2014-07-18</lastmod>\n<changefreq>always</ Changefreq>\n</url> "}end{print" </urlset> "}"
Where Sitemap.txt is the collection of all URLs of the site,<lastmod> the date after, you need to change the date when you generated the sitemap file, today is July 18, 2014, so I wrote this.
In fact, with the TXT format sitemap Baidu is also recognized, in order to reflect the powerful shell, I have to put the TXT format toss into XML format!!! The Sitemap.txt content is shown below, with a total of 12,053 URLs.
Final effect and build speed, a total of 12,053 URLs, generate XML sitemap, only spents 4.3 seconds! The speed is still quite fast!