google sitemap生成器使用方法.docx

上传人:b****7 文档编号:11370975 上传时间:2023-02-28 格式:DOCX 页数:73 大小:36.63KB
下载 相关 举报
google sitemap生成器使用方法.docx_第1页
第1页 / 共73页
google sitemap生成器使用方法.docx_第2页
第2页 / 共73页
google sitemap生成器使用方法.docx_第3页
第3页 / 共73页
google sitemap生成器使用方法.docx_第4页
第4页 / 共73页
google sitemap生成器使用方法.docx_第5页
第5页 / 共73页
点击查看更多>>
下载资源
资源描述

google sitemap生成器使用方法.docx

《google sitemap生成器使用方法.docx》由会员分享,可在线阅读,更多相关《google sitemap生成器使用方法.docx(73页珍藏版)》请在冰豆网上搜索。

google sitemap生成器使用方法.docx

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

-->

url="

default_file="index.html"

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 营销活动策划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1