google sitemap生成器使用方法.docx
- 文档编号:11370975
- 上传时间:2023-02-28
- 格式:DOCX
- 页数:73
- 大小:36.63KB
google sitemap生成器使用方法.docx
《google sitemap生成器使用方法.docx》由会员分享,可在线阅读,更多相关《google sitemap生成器使用方法.docx(73页珍藏版)》请在冰豆网上搜索。
googlesitemap生成器使用方法
WebmasterTools
WebmasterCentral
UsingtheSitemapProtocol
UsingtheSitemapGenerator
Contents
Beforeyoubegin
DownloadingtheSitemapGeneratorprogramfiles
Creatingaconfigurationfile
Uploadingthefilestoyourwebserver
RunningtheSitemapGeneratorscript
SubmittingyourSitemaptoGoogle
Troubleshooting
Beforeyoubegin
TheGoogleSitemapGeneratorisaPythonscriptthatcreatesaSitemapforyoursiteusingtheSitemapProtocol.ThisscriptcancreateSitemapsfromURLlists,webserverdirectories,orfromaccesslogs.Inordertousethisscript:
∙Youmustbeabletoconnecttoandrunscriptsonyourwebserver.
∙YourwebservermusthavePython2.2orlaterinstalled.
∙YoumustknowthecommandthatlaunchesPython.(Generally,thisispython,butmayvarybyinstallation.Forinstance,ifthewebserverhastwoversionsofPythoninstalled,theearlierversionmaybeinvokedbythecommandpythonandthelaterversionmaybeinvokedbythecommandpython2.)
∙Youmustknowthedirectorypathtoyoursite.Ifyourwebserverhostsonesite,thismaybeapathsuchasvar/www/html.Ifyouhaveavirtualserverthathostsmultiplesites,thismaybeapathsuchashome/virtual/site1/fst/var/www/html.
∙Youmustbeabletouploadfilestoyourwebserver(forinstance,usingFTP).
∙IfyouwillbegeneratingalistofURLsbasedonaccesslogs,youmustknowtheencodingusedforthoselogsandthecompletepathtothem.
Ifyouaren'tsureaboutanyofthis,youcancheckwithyourwebhostingcompany.
Nowyou’rereadytogetstarted.Here’sanoverviewofwhatyou’llneedtodo.
1.DownloadtheSitemapGeneratorprogramfiles.Extractthefilestoalocaldirectory.
2.Createaconfigurationfileforyoursiteusingtheprovidedexample_config.xmlfileasatemplate.Modifythisfileasneededforyoursiteandsaveit.
3.Uploadthenecessaryfilestoyourwebserver.
4.Runsitemap_gen.py.
5.AddthegeneratedSitemaptoyourGooglewebmastertoolsaccount.
6.Setuparecurringscript.(optional)
IfyouareunabletousetheSitemapGenerator,youcanaddaSitemaptoyourGooglewebmastertoolsaccountinanotherformat,suchasasimpletextfile.Third-partyprogramssupportingtheSitemapProtocol.
ForNewsSitemaps:
TheSitemapGeneratorisnotrecommendedforuseincreatingGoogleNewsSitemapsatthistime,duetothespecialrequirementsofNewsSitemaps.NewsSitemapsareintendedtobedynamiclistsofonlythemostrecentlypublishednewsarticles(ratherthantheentirewebsite),andtheyareupdatedfrequently.
1.DownloadingtheSitemapGeneratorprogramfiles
TheSitemapGeneratorfilesareavailableinZIPandGZarchiveformatsfromthefollowinglocation:
Onceyoudownloadthearchive,extractitintoalocaldirectory.Locatethefollowingfiles:
∙README—containsthelatestinformationaboutthistool
∙sitemap_gen.py—thepythonscriptthatgeneratesyourSitemap
∙example_config.xml—thetemplateconfigurationfileyou’llusetospecifytheconfigurationforyoursite
∙example_urllist.txt—thetemplateURLlistyoucanuseifyouwishtocreateaSitemapbasedonasetofURLsthatyouspecify
2a.Creatingaconfigurationfile
Thissectionprovidesstep-by-stepinstructionsforcreatingaconfigurationfile.Italsoprovidesacompletereferenceoftheoptionsavailable.IfyouarecreatingMobileSitemaps,seetheadditionalmobileguidelines.
Inordertocreateaconfigurationfileforyoursite,youmusthavethefollowinginformation:
∙ThebaseURLforyoursite(suchasEnsurethatyouincludetheprotocol(suchashttp:
//).Forinstance,isavalidbaseurl,butisnot.
∙ThewebserverpathtothelocationwhereyouwanttostoretheSitemap.Generally,thisisthepathtothebaseURLastheSitemapcannotcontainURLsthatareinahigher-leveldirectoryfromthelocationoftheSitemap.WhenyouruntheGoogleSitemapGenerator,itcreatestheSitemapandplacesitinthelocationyouspecify.
∙ThemethodsyouwanttheSitemapGeneratortousetocreateyourSitemap.Youcanuseanycombinationofmethods.Thefollowingmethodsareavailable:
oURL—listindividualURLsinthissectionoftheconfigurationfile,alongwithinformationabouteachURL.YouwouldgenerallyusethismethodinconjunctionwithanothermethodtomanuallyincludeadditionalURLsthatothermethodswouldn'tpickup.
oURLlist—pointtheconfigurationfiletoatextfilethatcontainsalistofURLs.YoumightwanttousethismethodifthistextfilealreadyexistsorifyouuseascripttogeneratealistofURLs.
oDirectorypaths—specifythedirectorypathsforyoursiteandcorrespondingURLstothosepaths.TheSitemapGeneratorwillcreatealistofURLsbasedonthecontentsofthosedirectories.YoumightwanttousethismethodifyoursiteconsistsofstaticHTMLfiles.
oAccesslogs—pointtothepathtoyourlogfiles.TheSitemapGeneratorwillcreatealistofURLsbasedontheURLsincludedinthelogs.Youmightwanttousethismethodifyoursiteconsistsofdynamicpages.
oSitemap—pointtoexistingSitemapsthatyouhavecreatedwiththeSitemapGenerator.TheSitemapGeneratorwillcreateasingleSitemapthatincludestheURLscontainedineachSitemap.YoucouldusethismethodifyouhavealreadycreatedseveralsmallerSitemapsthatyouwanttocombineintoonelargerSitemap.
Createtheconfigurationfileasfollows:
1.Opentheexample_config.xmlfileinatexteditor.Saveitasanewfile(suchasconfig.xmlormysite_config.xml).
2.Locatethesitedefinitionsection:
3. 4.base_url=" 5.store_into="/var/www/docroot/sitemap.xml.gz" 6.verbose="1"> 7.Changethebase_urlvaluetotheURLforyoursite. 8.Changethestore_intovaluetothepathonyourwebserverwhereyouwanttostoretheSitemapandthefilenameyouwanttousefortheSitemap.Generally,thisisthepathtothebaseURLsinceGooglecanonlyacceptURLsthatareatthesamelevelasorsubdirectoriesofthedirectorythatholdstheSitemap.Youcanspecifyarelativepathfromthedirectorywhereyouuploadthescriptoracompletepathfromtherootofyourwebserver.IfyouuploadthescripttoyourbaseURLdirectory,youcansimplyspecifythefilename. 9.Locatethegenerationmethodsectionsthatbeginwith**MODIFYorDELETE**.EachofthesesectionscorrespondstoamethodforgeneratingaSitemap. 10.Deletethesectionsforthemethodsyouaren’tgoingtouse. 11.Followtheinstructionsbelowforthemethodsyouaregoingtouse. URL Locatethefollowingsection: --**MODIFYorDELETE** "url"nodesspecifyindividualURLstoincludeinthemap. Requiredattributes: href-theURL Optionalattributes: lastmod-timestampoflastmodification(ISO8601format) changefreq-howoftencontentatthisURLisusuallyupdated priority-value0.0to1.0ofrelativeimportanceinyoursite --> href=" lastmod="2004-11-14T01: 00: 00-07: 00" changefreq="yearly" priority="0.3" /> Thissectiongivestwoexamples: thefirstincludesonlytherequiredattributeandthesecondincludestherequiredattributeaswellastheoptionalattributes. UsethisformatforeachoftheURLsyouwanttoinclude.ThechangefreqattributegivesGoogleageneralideaofhowoftentheURLisupdated.ThishelpsGoogleknowhowoftentovisitthepagefornewcontent.ThepriorityattributegivesGoogleinformationabouttherelativeimportanceofthispagecomparedtotheotherpagesofyoursite.ThisattributehasnoeffectonhowGooglecomparesyourpagetopagesonothersites,itjusthelpsGoogleknowwhichpagesofyoursitethatyouthinkaremostimportant. URLlist Locatethefollowingsection: --**MODIFYorDELETE** "urllist"nodesnametextfileswithlistsofURLs. Anexamplefile"example_urllist.txt"isprovided. Requiredattributes: path-pathtothefile Optionalattributes: encoding-encodingofthefileifnotUS-ASCII --> UsethisformattopointtothepathandnameofthetextfilethatcontainsyourlistofURLs.Youcanusetheprovidedexample_urllist.txtfileasatemplateforthattextfile.Youcanspecifyeitherarelativeorcompletepathtoyourwebserver.Forinstance,iftheSitemapGeneratorandurlist.txtfilearelocatedinthesamedirectory,youcansimplyspecifythefilenameofthe.txtfile,IfyoucreateatextfilewithanencodingotherthanUTF-8,youcanusetheencodingattributetoindicatethisencoding.Ifyouhavemultiple.txtfiles,youcanusewildcards.Forinstance: ForeachURLyouincludeinthetextfile,youcanspecifythelastmodificationdate,changefrequency,andpriority.SeetheURLlisttextfilereferencesectionforcompleteinformationaboutthestructureofthisfile. Directorypaths Locatethefollowingsection: --**MODIFYorDELETE** "directory"nodestellthescripttowalkthefilesystemand includeallfilesanddirectoriesintheSitemap. Requiredattributes: path-pathtobeginwalkingfrom url-URLequivalentofthatpath Optionalattributes: default_file-nameoftheindexordefaultfilefordirectoryURLs --> path="/var/www/docroot" url=" default_file="index.html"
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- google sitemap生成器使用方法 sitemap 生成器 使用方法