Sitemap (Wiki) - this is XML-file with the information for the search engines (such as Yandex, Google, Bing) about web pages, which are to be indexing. It helps search engines index the site more intelligently. Some SEO-experts consider the lack of such map a gross error. On the Internet there are many services and tools for creating these maps, as well as for their validation. We try to create sitemap using A-parser.
So, let's see what exactly we need to do.
HTML::LinkExtractor. He is able to collect from the site links to the specified depth and return the server response headers (which typically contains the date of last change). For the result output will respond template engine Template Toolkit, which will generate the right kind of output file.
Notes:
So, let's see what exactly we need to do.
- Check all internal links on the site.
- Find out all the necessary parameters for each link.
- Save all this information to a file sitemap.xml.
HTML::LinkExtractor. He is able to collect from the site links to the specified depth and return the server response headers (which typically contains the date of last change). For the result output will respond template engine Template Toolkit, which will generate the right kind of output file.
Code:
eyJwcmVzZXQiOiJzaXRlbWFwIiwidmFsdWUiOnsicHJlc2V0Ijoic2l0ZW1hcCIs
InBhcnNlcnMiOltbIkhUTUw6OkxpbmtFeHRyYWN0b3IiLCJkZWZhdWx0Iix7InR5
cGUiOiJvcHRpb25zIiwiaWQiOiJwYXJzZUxldmVsIiwidmFsdWUiOjN9LHsidHlw
ZSI6Im92ZXJyaWRlIiwiaWQiOiJmb3JtYXRyZXN1bHQiLCJ2YWx1ZSI6Ijx1cmw+
XFxuPGxvYz5bJSBxdWVyeSB8IHhtbCAlXTwvbG9jPlslIElGIGxtWWVhciAhPSAn
bm9uZScgJV1cXG48bGFzdG1vZD4kbG1ZZWFyLVslIFNXSVRDSCBsbU1TdHJpbmcg
JV1bJSBDQVNFICdKYW4nICVdMDFbJSBtPScwMScgJV1bJSBDQVNFICdGZWInICVd
MDJbJSBtPScwMicgJV1bJSBDQVNFICdNYXInICVdMDNbJSBtPScwMycgJV1bJSBD
QVNFICdBcHInICVdMDRbJSBtPScwNCcgJV1bJSBDQVNFICdNYXknICVdMDVbJSBt
PScwNScgJV1bJSBDQVNFICdKdW4nICVdMDZbJSBtPScwNicgJV1bJSBDQVNFICdK
dWwnICVdMDdbJSBtPScwNycgJV1bJSBDQVNFICdBd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GVuZCI6IjwvdXJsc2V0PiIsInF1ZXJ5QnVpbGRl
cnMiOltdLCJyZXN1bHRzQnVpbGRlcnMiOltdLCJjb25maWdPdmVycmlkZXMiOltd
fX0=
Notes:
- Not every server and not for each page returned a header last-modified;
- based on availability last-modified header for the current link will be (or not, if the header is not returned) describes the parameters <lastmod> and <changefreq>;
- <changefreq> is calculated based on the period of time that has elapsed since the last modification of the page;
- <priority> is calculated depending on the depth of the page;
- depth of collecting of links regulated by parameter Parse to level;
- not recommended to set a large depth, because limit in one sitemap.xml is 50000 URL.