前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Mediawiki 生成google sitemap

Mediawiki 生成google sitemap

作者头像
JadePeng
发布2018-03-12 14:31:38
2K2
发布2018-03-12 14:31:38
举报

首先,看扩展:

Extension:Google Sitemap

在扩展页面看到下面的说明:

Note: Since MediaWiki 1.6, the MediaWiki core has a Google site map generator which may be more appropriate than this extension. It is a command-line utility, and it is located at maintenance/generateSitemap.php in your MediaWiki directory. The command line is "php generateSitemap.php sitename" and is run from the maintenance directory at the server's command line interface. See Manual:generateSitemap.php for more information.

自mediawiki 1.6版本,mediawiki 核心已经包含了一个google site map 生成器,是个命令行工具,包含下面的参数

Options

--help

显示帮助  generateSitemap.php

--fspath=<path>

指定sitemap保存路径, e.g /tmp/sitemap/

--urlpath=<prefix>

url前缀 --fspath, e.g. http://wiki.example.com/sitemap/不过这个玩意在1.16的版本里还没有,需要自己修改下代码,或者从svn签出最新的代码--server=<server>mediawiki的服务器 e.g. http://en.wikipedia.org最好指定这个参数,不然会读取服务器的名字,如果你的服务器名字和网站域名不一致的话,生成的url就不对了This is sometimes necessary because server name detection may fail in command line scripts and will show up only as "localhost" in the xml files. (included in 1.12.0; may not be included in 1.14.0 (verification needed)

--compress=[yes|no]

是否压缩,选择yes的话会将sitemap压缩

Whether or not to compress the sitemap files. The default setting is yes.

实战举例:生成codingwiki.info编程百科sitemap

代码语言:javascript
复制
php generateSitemap.php --fspath /home/wwwroot/codingwiki/sitemap/ --urlpath http://codingwiki.info/sitemap/ --server http://codingwiki.info --compress no

生成结果如下:

image
image

其中sitemap-index-codingwiki-codingwiki_.xml是sitemap的索引页面,将这个页面提交给google就可以了

image
image

PS,codingwiki.info使用的是burst的vps,$5.95/MONTH,性价比不错,有需要的同学可以点下面的链接去购买,用paypal支付就可以

https://service.burst.net/aff.php?aff=1406

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2011-03-03 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Extension:Google Sitemap
    • Options
    相关产品与服务
    命令行工具
    腾讯云命令行工具 TCCLI 是管理腾讯云资源的统一工具。使用腾讯云命令行工具,您可以快速调用腾讯云 API 来管理您的腾讯云资源。此外,您还可以基于腾讯云的命令行工具来做自动化和脚本处理,以更多样的方式进行组合和重用。
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档