Movable Type で特定のカテゴリの情報を取り出せる SpecificCategory プラグインを公開します
- CATEGORY
- 製品
- TAG
- SpecificCategory
Movable Typeの各テンプレートで、特定のカテゴリの情報を取り出して使うことが出来る SpecificCategory プラグインを公開します。
bit-part/mt-plugin-SpecificCategory · GitHub
https://github.com/bit-part/mt-plugin-SpecificCategory
プラグインをインストールすると MTSpecificCategory というブロックタグが使える様になるので、モディファイアでカテゴリを指定します。
使い方
<mt:SpecificCategory>
Do something.
</mt:SpecificCategory>
モディファイア
id
id モディファイアでカテゴリIDを指定して、特定のカテゴリを選択します。id 以外のモディファイアを指定した場合、それらの指定は無視され、id モディファイアの指定が優先されます。
<mt:SpecificCategory id="N">
Do something.
</mt:SpecificCategory>
label
label モディファイアでカテゴリ名を指定して、特定のカテゴリを選択することが出来ます。
このとき、 下記の blog_id モディファイアを指定しない場合は、現在のコンテキストのブログの中から該当する label のカテゴリを探します。
<mt:SpecificCategory label="hogehoge">
Do something.
</mt:SpecificCategory>
basename
basename モディファイアで、カテゴリの basename を指定して特定のカテゴリを選択することが出来ます。 このとき、 下記の blog_id モディファイアを指定しない場合は、現在のコンテキストのブログの中から該当する basename のカテゴリを探します。
<mt:SpecificCategory basename="hogehoge">
Do something.
</mt:SpecificCategory>
blog_id
blog_id モディファイアにブログIDを指定することで、特定のブログの中からカテゴリを選択することが出来ます。blog_id モディファイアを選択していないときは、現在のコンテキストのブログの中のカテゴリが優先されます。
blog_id モディファイアは、上記の label モディファイアまたは basename モディファイアと併用して使います。
既知の問題
- 現在、スタティック専用のプラグインです。
- 同じブログ内の複数の階層に同じ label や basename のカテゴリがある場合、希望したカテゴリが取り出せない場合があります。このような場合は id モディファイアでカテゴリを指定してください。後日、階層指定出来るようにアップデートします。
We released SpecificCategory Plugin. This plugin sets a context of specific category, and you can use some values of the category.
bit-part/mt-plugin-SpecificCategory · GitHub
https://github.com/bit-part/mt-plugin-SpecificCategory
This is a Movable Type Plugin that provide MTSpecificCategory Block Tag.
Usage
<mt:SpecificCategory>
Do something. You can use any category tags.
</mt:SpecificCategory>
Modifiers
id
The ID of category.
If you set the id, other modifiers are ignored.
label
The name of cateogry.
basename
The basename of cateogry.
blog_id
The ID of blog.
When you use MTSpecificCategory tag in website context, you must set the blogid modifier. If you use MTSpecificCategory tag without setting the blogid modifier in blog context, it is automatically set a ID of blog of the current context.
You use blog_id modifier with label modifier or basename modifier.
Some bugs
- This plugin is only for Static Publishing.
- If there are same labels or same basenames in a blog, not work well. In this case, you need use id modifier. We'll update soon for selecting categories with parent and child.