成人视频在线观看香蕉|日韩黑人无码伊人国内自拍|亚洲色情AV导航|一道本成人无码免费小影片|91刺激五月色婷婷乱伦|97蜜臀国产在线观看|91先生网站黄色|中文字幕66页|亚洲无码砖区欧美婷婷综合|手机人成日韩国产性爱小视频

Sorry, you are not login!
VIP members can check the contents after login.
Click to login

  • TOP
  • Moblie
    All Prompt Messages

    Tradesns Foreign Trade Community
    Current page location: Home > Training > 如何制作網站robots.txt、sitemap.xml文件
    如何制作網站robots.txt、sitemap.xml文件
    Browse volume:2982 | Reply:0 | Release time:2018-06-13 09:59:24

    robots.txt | sitemap.xml制作生成

    一個網站上線之初,就要立即提交robots.txt、sitemap.xml文件。這樣做的目的,就是要通知搜索引擎:我的網站,您可以安排蜘蛛過來,按照我的網站地圖,進行抓取了。


    那么,如何制作網站robots.txt、sitemap.xml文件呢?


    1. robots.txt


    robots.txt的作用:


    (1)發(fā)出公告,定向通知搜索引擎,前來抓取你的網站。

    (2)目錄篩選:告訴引擎的蜘蛛,我網站上面的文件目錄,哪些是可以抓取的,哪些是不允許抓取的。

    (3)指明路徑:向蜘蛛說明,在允許抓取的文件目錄中,按照什么樣的方式(sitemap)進行抓取,防止蜘蛛走丟,遺漏重要的網站內容。


    robots.txt的格式:


    # robots.txt generated at http://tool.chinaz.com/robots/           //  頭部聲明:主要說明,這個robots.txt文件來自于哪里,可以不寫  //

    User-agent:                                                                             //  代理聲明:告訴引擎,網站允許哪些引擎的蜘蛛前來爬取  //

    Disallow:                                                                                  //  限制聲明:通知前來抓取的蜘蛛,網站哪些目錄文件,不允許抓取  //

    Sitemap: example.com/sitemap.xml                                         //  sitemap聲明:通知前來抓取的蜘蛛,如果爬取,請按照這個路線進行數據抓取  //


    robots.txt的生成:


    (1)自己編寫,在本地建立txt文件,將上述幾點進行編寫即可。

    (2)工具生成robots.txt:站長工具。


    robots.txt的上傳:


    將生成完畢的robots.txt文件,上傳到網站根目錄下,即可。


    2. sitemap.xml


    sitemap.xml的作用:


    (1)通知前來抓取網站的搜索引擎蜘蛛,按照什么樣的路徑進行抓取。

    (2)通知前來抓取網站的搜索引擎蜘蛛,按照什么樣的頻率進行抓取。


    sitemap.xml的格式:


    <?xml version="1.0" encoding="UTF-8"?>                                //  version="1.0" 聲明用的xml版本是1.0  //

                                                                                                     //  encoding="UTF-8" 聲明用xml傳輸數據的時候的字符編碼,假如文檔里面有中文,編                                                                                                      碼方式不是UTF-8,傳輸過去再解碼的話中文就會是亂碼  //

    <?xml-stylesheet type="text/xsl" href="sitemap.xsl"?>               //  采集網站數據的采集方式,可以是txt文本格式,也可以以xsl數據格式進行采集  //

    <urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">             //  sitemap的協(xié)議,類似于wc3協(xié)議,必填項,否則無法開始抓取  //


    <url>

      <loc>頁面網址</loc>                                                               //  輸入需要爬取的頁面的網址  //

      <lastmod>頁面最近更新時間</lastmod>                                         //  注明頁面最近更新的時間  //

      <changefreq>頁面更新頻率</changefreq>                             //  確定頁面更新頻率(daily、weekly、monthly、yearly...)  //

      <priority>頁面抓取優(yōu)先級</priority>                                        //  設定頁面優(yōu)先級,可選值:0.0~1.0。越趨近與1.0,說明這個頁面越重要  // 

    </url>


    </urlset>                                                                                  //  結束抓取  //                                


    sitemap.xml的生成:


    (1)sitemap.xml文件最好自己編寫,防止遺漏網站的重要頁面。

    (2)開始,在txt文本格式下進行編輯。按照上面的格式,寫完之后,直接將.txt變成.xml即可。        


    sitemap.xml的上傳:


    將生成完畢的sitemap.xml文件,上傳到網站根目錄下,即可。            

    Concern (0)
    Commentary(0)
    Share
    +13
    Popular
    Relevant
    How to do business with Americans?
    author
    Tradesns.com
    Reply:0 | Release time:2018-06-06 16:03:40
    How to find customers through Google in foreign trade(二)
    author
    Tradesns.com
    Reply:0 | Release time:2018-06-07 10:36:33
    Major port cities in India
    author
    Tradesns.com
    Reply:0 | Release time:2018-06-08 13:22:02
    How to correctly judge the effective demand in the foreign trade?
    author
    Tradesns.com
    Reply:0 | Release time:2018-06-06 16:07:50
    What should new foreign traders do?
    author
    Tradesns.com
    Reply:0 | Release time:2018-06-08 11:09:13
    Tips for releasing Products
    author
    Tradesns.com
    Reply:0 | Release time:2018-06-07 11:17:19
    How to find customers through Google in foreign trade(一)
    author
    Tradesns.com
    Reply:0 | Release time:2018-06-07 10:34:30
    How to become a good foreign trade officer
    author
    Tradesns.com
    Reply:0 | Release time:2018-06-08 10:56:42
    Trap recognition in the experience of foreign trade
    author
    Tradesns.com
    Reply:0 | Release time:2018-06-06 16:05:49