Introduction
This plugin allow you to customize the permalink structure of every content types and its corresponding comments atom feed of Habari powered blog. The following are the two predefined content types for default Habari installation.
- Entry
- Page
For the sake of consistency of content type permalink and its comments atom feed, you could choose to customize comments atom feed based on its content type permalink. If you do so, permalink of comments atom feed will become content type permalink appended with '/atom/comments'. Otherwise, you can customize it separately.
This plugin retrieve the content types dynamically. Whenever there is new content type added, that new content type will be shown in plugin configuration page.
Installation
- Unzip the file
- Put the folder 'custompermalink' to /user/plugins and activate it
Configuration Option
After activated it, click <Configure> button to setup the plugin. You can use any text together with the following structure tags to construct your permalink.
- %slug% - Slug of post
- %id% - ID of post
- %year% - 4-digit year of publish date
- %month% - 2-digit month of publish month
- %day% - 2-digit day publish day
Due to unique identifier is required to retrieve the post, either %slug% or %id% must be used in permalink.
Usage
Once configured, the new permalink structure will be effective immediately.
Note
- This plugin only supported Habari SVN r1464 or later since the comments atom feed of entry and page are shared and not yet separated in the previous version.
- If both comment permalink is defined and customize checkbox is checked, comment permalink setup will become dominant.
- Version 0.7 modified to use new FormUI and comply to the new standard of configuration name, please make sure you are using Habari SVN r1948 or later and configure the plugin again.
Changelog
- Version 0.5 - Initial release
- Version 0.6 - Fixed a regular expression bug caused the failure of pagination in some scenario, thanks 亿城雪 for the info
- Version 0.7 - Modified to support new FormUI and some code cleanups
Download here (Downloaded 782 times)
=====================
簡介
這個 plugin 是用作自行設定 Habari blog 內所有 content type 的永久連結 (permalink) 結構,以下是安裝 Habari 後預設的 content types。
- Entry
- Page
為了維持 conent type 永久連結和其留言 Atom feed 永久連結的統一,大家可以選擇以 content type 永久連結作基準作設定,若選擇這樣做的話,留言 Atom feed 永久連結會是由 content type 永久連結後加 '/atom/comments' 而成。當然大家亦可選擇自行設定每款 content type 留言 Atom feed 的永久連結。
這插件會自行讀取 database 內的 content type。當有新增的 content type 時,永久連結設定會自動顯示在設定頁面中。
安裝
- 將下載了的 zip file 解壓
- 把 'custompermalink' folder 放在 /user/plugins 中,然後啟動 plugin
設定選項
啟動 plugin 後,click <Configure> 按鈕來設定選項,大家可以使用任何文字加上以下的 structure tags 來設定永久連結。
- %slug% - Post 的 slug
- %id% - Post 的 ID
- %year% - 4 位數字的發布年份
- %month% - 2 位數字的發布月份
- %day% - 2 位數字的發布日期
因為讀取一篇文章需要 unique identifier,所以 %slug% 或 %id% 是必須使用的。
使用方法
當設定完成後,新的永久連結結構會即時生效。
注意事項
- 這插件只支援 SVN r1464 或以後的 Habari 版本,因為之前版本的 entry 和 page 的留言永久連結是共用的,還未獨立分開。
- 若同時設定了留言永久連結和選取了 'Customize ... Comments permalink base on ... permalink' 的 checkbox,留言永久連結的獨立設定將會優先採用。
- Version 0.7 轉用了新的 FormUI 加上跟隨了新的 configuration name 命名,請使用 Habari SVN r1948 或以後的版本,及重新設定 plugin
版本資料
- Version 0.5 - 首次公開版本
- Version 0.6 - 修正一個 regular expression 錯誤引致的 pagination 失效問題,謝謝亿城雪報告這問題
- Version 0.7 - 使用了新的 FormUI 和 code cleanups
下載連結(已經下載了 782 次)
Good Job.已经启用。演示http://habari.org.ru
使用了最新的truck版本,使用该插件后报Could not include class file 332w83sshopo4s.php
將 custom permalink 內兩句 add_validator() 前加上 //,plugin功能正常,但是page功能不正常,此现象与在0.4.1版下相同,这也是我为什么trunk最新版的原因。
在$ui->on_success( array( $this, 'updated_config' ) );前面加入 //,现象依旧。
有試 Feedburner plugin,正常。
@億城雪:何謂「plugin功能正常,但是page功能不正常」?Feedburner plugin 儲存設定也沒有問題?
http://www.baiyang.net/page/2
http://www.baiyang.net/page/3
http://www.baiyang.net/page/4
一看便知
@億城雪:是否 comment 了 add_validator() 那兩句便沒有了 "Could not include class file 332w83sshopo4s.php" 這個問題?
另外,我的 plugin 應該不會影響 page 的 rewrite rule,是否 deactivate plugin 後 page 功能便正常了?
用了您mail我的那个plugin,现象依旧。btw,俺又升级了最新的truck,1568
设置成%id%/1无问题,详情可见俺的blog。
@億城雪:"Could not include class file 332w83sshopo4s.php" 這個問題在 r1594 (http://trac.habariproject.org/habari/changeset/1594) 解決了,請升級至該版本試試看。
已升级,故障依旧。
不报错,但post还是错误的。
@億城雪:發現問題的原因是因為使用 ID 時的 regular expression 令到 pagination 也 match 了 entry permalink 的 rewrite rule,要花點時間看看怎樣解決。
唔该,停用其他plugin,故障依旧。btw,我使用的plugin:Pingback,PreApproved,Spam Checker
已更新,问题解决。唔该晒。regular expression复杂难理解又容易出错,辛苦您了。
不久将会用到,先来看一下喽。