修改MT的作者归档路径
Movable Type 的按作者归档,是以作者的"显示名称"(AuthorDisplayName)为路径名的,这给我带来了很大的麻烦。因为如果显示名称设定为完全的中文,MT 是不能以此为路径名的,它只能用作者编号来代替。
比如说一个作者,注册名称(AuthorName)为 apple,显示名称(AuthorDisplayName)为Jobs,作者编号(AuthorID)为1;
另一位作者,注册名称为 bill,显示名称为比尔,作者编号为2。
那么 MT 在进行作者归档的时候,apple 就会被归档在 "/jobs/index.html",而 bill 的路径则是"/author2/index.html",对用户和搜索引擎都很不友好。
不知道 MT 为何这样设定,并且没有提供更改选项。
如果系统有很多作者,显示名称重复了它会如何处理呢?
另外如果使用了汉化,"authorX" 会被汉化为"作者(X)",MT 将会进行错误的作者归档,可能会造成首页的错误。
我试着用 AuthorName 替代 AuthorDisplayName,基本解决了这个问题。
方法是修改 ContextHandlers.pm 这个文件(路径为 lib\MT\Template)。
下载、备份这个文件,找到下面这一行:
'a' => "<MTAuthorDisplayName $dir>,
把它替换为
'a' => "<MTAuthorName $dir>",
重新上传,覆盖。
然后登录 MT 后台管理,修改归档模版的 Entry Listing 模版。
在归档映射那里,把"按作者"归档的路径自定义为 %a/%f,"按作者以月"自定义为 %a/%y/%m/%f。保存,重建系统,应该就 OK 了。
也许你已经发现,这个修改方式很暴力。那是因为我并没有看懂代码,只能试着进行简单的替代。欢迎提供更好的修改方法。
14 条评论
I am apreciating it very much.I have never read such a wonderful article and I am coming back tomorrow to continue reading.
The article written by you very good, I like it very much. I will keep your new article.
my friend told me that this blog is competitive. i will read more.
More please, this information helped me consider a few more things, keep up the good work.
I am apreciating it very much.I have never read such a lovely article and I am coming back tomorrow to continue reading.
The article written by you very good, I like it very much. I will keep your new article.
More please, this information helped me consider a few more things, keep up the good work.
my friend told me that this blog is competitive. i will read more.
This article is informative and interesting,I enjoy reading it.
It is my pleasure to read this article,I look forward to reading more.
I am interest in reading this article,I will read more.
welcome to www.topbulksite.com company can supply many styles of clothes, shoes and boots, handbags, hats, sunglasses, belts, jewelries and so on.our website is www.topbulksite.com you can view it…
Welcome to our company, we supply many styles of clothes, shoes and handbags, hats, sunglasses, belts, jewelries and so on. Hope you can like them.
