Forum Home

发布新话题

Popular topics

修改MT的作者归档路径 MovableType 改进

user-pic
Vote 1 Vote
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 了。 也许你已经发现,这个修改方式很暴力。那是因为我并没有看懂代码,只能试着进行简单的替代。欢迎提供更好的修改方法。 参考文档:Archive File Path Specifiers原文链接:http://www.ashowbox.com/2008/03/mt-authordisplayname-archive.html...

1 Reply

最新评论

user-pic
Recent Topics Replies Last Reply
user-pic
从Wordpress转移到Movabletype
Vote 0 Votes
4
user-pic
user-pic
给博客添加信件通知留言本
Vote 1 Vote
2
user-pic
dewplayer播放器的使用方法
Vote 0 Votes
1
user-pic
28, 2006
user-pic
通过Zoundry写博客
Vote 0 Votes
1
user-pic
user-pic
coComment
Vote 0 Votes
1
user-pic
10, 2006
user-pic
MT重建出现的问题
Vote 0 Votes
2
user-pic
29, 2006
user-pic
Movable Type 中文化 - 平生一笑
Vote 0 Votes
1
user-pic
22, 2009
user-pic
Blogcs 为MovableType 爱好者提供博客服务
Vote 0 Votes
2
user-pic
4, 2009
user-pic
MT BLogroll Api Url 和Bug 的修改
Vote 0 Votes
0 回复
user-pic
Zhu8's Weblog:猪八的网:浮生志
Vote 0 Votes
0 回复
最新评论
user-pic
从Wordpress转移到Movabletype on 27, 2011
user-pic
Blogcs 为MovableType 爱好者提供博客服务 on 4, 2009
user-pic
Movable Type 中文化 - 平生一笑 on 22, 2009
给博客添加信件通知留言本 on 21, 2009
user-pic
dreamhost完美支持MT on 9, 2009
user-pic
有没有合租空间的 on 9, 2009
user-pic
使用Windows Live Writer在MovableType发表文章出现乱码 on 23, 2009
user-pic
使用Windows Live Writer在MovableType发表文章出现乱码 on 18, 2009