One line of code to generate Google SiteMap

Source: Internet
Author: User
Tags copy
Google|sitemap

Javascript:var%20u=document.location.href;var%20t=prompt (' Input update time: \n\n\n ', '); var%20p=prompt (' Input index rank: \n\n\n ', ' 1.0 '); var%20c=prompt (' Input update frequency: \n\n\n ', ' Always '); var%20l=document.links;var%20s= ' \ n '; for (Var%20i=0;i <> \ n ' +l[i]+ ' \ +t+ ' +c+ ' \ n ' +p+ ' \ n ';} s+= '; clipboarddata.setdata (' text ', s); alert (' to copy to Clipboard '); > One-line code generation Sitemap

You can also copy the following content to the address bar to hit ENTER:)

Javascript:var u=document.location.href;var t=prompt (' Input update time: \n\n\n ', '); var p=prompt (' Input index rank: \n\n\n ', ' 1.0 '); var c =prompt (' Input update frequency: \n\n\n ', ' Always '); var l=document.links;var s= ' <urlset%20xmlns= ' http://www.google.com/schemas/ sitemap/0.84 ">\n"; for (var i=0;i<l.length;i++) {s+= ' <url>\n<loc> ' +l[i]+ ' </loc>\n< Lastmod> ' +t+ ' </lastmod>\n<changefreq> ' +c+ ' </changefreq>\n<priority> ' +p+ ' </ Priority>\n</url>\n ';} s+= ' </urlset> '; clipboarddata.setdata (' text ', s); alert (' to copy to Clipboard ');<br/>

The principle is simple, using JavaScript script code to extract all links in the current page and generate standard google sitemap format source code. It is recommended that you save this link to the shortcut Bar, Using the method is just like the quick operation of del.icio.us, after executing the script on any page in your site, the sitemap code is automatically generated and saved in your clipboard, pasted into Notepad for utf-8 encoding, and you can combine the code under multiple pages, but don't exceed 100k



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.