If the blog is managed using HEXO, SiteMap can use the plugin to generate. But for a content management website, the backend may be an Express, Koa’s framework. At this time, SiteMap needs you to generate
What is SiteMap
SiteMap can easily notify Search Engines which are available on their website. The simplest SiteMap form is the XML file where the URL in the website is listed and other metadata on each URL (the time, the frequency of the change, the frequency of the change, and the other URLs on the website), etc.) So so that the search engine can more intelligently grabbed the website.
2019-01 LOC: Article Link address LastMod: Last UpdateChangefreq: DAILY / MONthly
- Generate SiteMap Based on Express project
- Open source package: Sitemap, address: https://github.com/ekalininin/sitemap.js
> NPM Install –save SiteMap
above The method can be used when the number of articles is small, and if there are thousands or even tens of thousands of articles, the way to pull it is not suitable, just write the return result into the file, updated one day. It only needs to be changed to
fs.writeFileSync (“app / assets /sitemap.xml, SiteMap.Tostring ()); . Each time you request SiteMap
The above is the full content of this article, I hope that everyone’s learning is helpful, I hope everyone will support Tumi Cloud.