Habari - RN Custom Permalink Plugin

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

  1. Unzip the file
  2. 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
  • Version 0.7a - Modified to support both Habari 0.7-alpha (trunk) and Habari 0.6.x (stable) version

Download

=====================

簡介

這個 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 時,永久連結設定會自動顯示在設定頁面中。

安裝

  1. 將下載了的 zip file 解壓
  2. 把 '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
  • Version 0.7a - 支援 Habari 0.7-alpha (trunk) 和 Habari 0.6.x (stable) 版本

下載

34 Responses to “Habari - RN Custom Permalink Plugin”

  1. 17941

    Good Job.已经启用。演示http://habari.org.ru

  2. 19388

    使用了最新的truck版本,使用该插件后报Could not include class file 332w83sshopo4s.php

  3. 19556

    將 custom permalink 內兩句 add_validator() 前加上 //,plugin功能正常,但是page功能不正常,此现象与在0.4.1版下相同,这也是我为什么trunk最新版的原因。
    在$ui->on_success( array( $this, 'updated_config' ) );前面加入 //,现象依旧。
    有試 Feedburner plugin,正常。

  4. 19573

    @億城雪:何謂「plugin功能正常,但是page功能不正常」?Feedburner plugin 儲存設定也沒有問題?

  5. 19965

    http://www.baiyang.net/page/2
    http://www.baiyang.net/page/3
    http://www.baiyang.net/page/4
    一看便知

  6. 19999

    @億城雪:是否 comment 了 add_validator() 那兩句便沒有了 "Could not include class file 332w83sshopo4s.php" 這個問題?

    另外,我的 plugin 應該不會影響 page 的 rewrite rule,是否 deactivate plugin 後 page 功能便正常了?

  7. 20026

    用了您mail我的那个plugin,现象依旧。btw,俺又升级了最新的truck,1568

  8. 20138

    设置成%id%/1无问题,详情可见俺的blog。

  9. 20199

    @億城雪:"Could not include class file 332w83sshopo4s.php" 這個問題在 r1594 (http://trac.habariproject.org/habari/changeset/1594) 解決了,請升級至該版本試試看。

  10. 20233

    已升级,故障依旧。

  11. 20234

    不报错,但post还是错误的。

  12. 20356

    @億城雪:發現問題的原因是因為使用 ID 時的 regular expression 令到 pagination 也 match 了 entry permalink 的 rewrite rule,要花點時間看看怎樣解決。

  13. 20376

    唔该,停用其他plugin,故障依旧。btw,我使用的plugin:Pingback,PreApproved,Spam Checker

  14. 20386

    已更新,问题解决。唔该晒。regular expression复杂难理解又容易出错,辛苦您了。

  15. 76837

    不久将会用到,先来看一下喽。

  16. 78910

    也可以用中文留言哦,忽忽~

    http://www.kuanruo.com

  17. 78911

    也可以用中文留言哦,忽忽~

    http://www.kuanruo.com

  18. 79331

    使用了最新的truck版本

  19. 79463

    不错的插件~~~~~~~~~

  20. 80359

    Hi! and thanks for this wonderfull plugin, just wonder if you wanna update the plugin for Habari 0.7 and implement a feature like "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec" for %month% maybe call it %monthnames% exempel > archives/2008/january/12/ something new :) or just archives/2008/jan/12/. thanks again for this great plugin.

  21. 80428

    @Xmion, the plugin is updated for 0.7-alpha. For the new feature request, I will study to see if it can be added to the next version. ;)

  22. 80896

    固定链接修改成/%postname%.html
    改了自定义以后 还需要做什么?

    我是初次建WP博客,不太懂这些怎么设置,我的意思是改了这个格式以后还要做些什么,比如改什么数据需要吗? 我以后写文章的时候要添加什么么?

    我之前写的文章需要改么?

    希望高手门前来指导

  23. 80904

    @尤Q:若需要用 postname 而又要有 .html 作尾的話,應該設定成 %slug%.html,設定後便行了。

    %slug% 的值亦即是在 "Publish Post" -> "Settings" 內的 "Content Address",Habari 會自動將你的文章標題作為 "Content Address" 的。 ;)

  24. 82453

    对Habari了解甚少,不知道 对简体中文支持怎么样?
    请达人指教

  25. 82543

    @邂逅你的美丽:Habari 內部是使用 UTF-8,所以儲存、顯示簡體中文並沒有任何問題,至於介面方面,只要你設定 locale 為 zh-cn,就可以轉換成簡體中文介面。 ;)

  26. 82577

    不错,拜读了

  27. 83880

    Hello, I activated the plugin, and only the default post by Habari worked. The other posts' permalinks like 2010/12/12/slug/ couldn't display the content, the page get an error "Error!
    The requested post was not found."

    Why? Do you give me a solution?

    Thanks.

  28. 83883

    Hi, I have solved the problem. My permalinks looks like year/month/day/slug/ (with the trail) the same as in wordpress, the RC permalink worked after I deleted the trail, now it looks like year/month/day/slug

  29. 86994

    "Publish Post" -> "Settings" 我怎么没有看到所说的地方。。。

  30. 87014

    @李娜:就是在發布文章,內文內容下面的位置。 ;)

  1. 80417 RN Custom Permalink Plugin 0.7a @ 天佑的自由天地
  2. 28805 Habari越来越Cool
  3. 25208 RN Custom Permalink Plugin 0.7 @ 天佑的自由天地
  4. 25206 Habari - RN Custom Permalink Plugin @ 天佑的自由天地

Leave a Reply