5.4 テンプレートセットの作成
config.yaml
name: sample template set
version: 0.01
description: SampleTemplateSet
author_name: foo
author_link: http://user-domain/
plugin_link: http://user-domain/plugin.html
doc_link: http://user-domain/sample.html
l10n_class: SampleTemplateSet::L10N
template_sets:
SampleTemplateSet:
label: Sample Template Set
base_path: templates
order: 100
templates:
index:
main_index:
label: Main Index
outfile: index.html
build_type: 1
archive_index:
label: Archive Index
outfile: archives.html
build_type: 1
styles:
label: Stylesheet
outfile: styles.css
build_type: 1
javascript:
label: JavaScript
outfile: mt.js
build_type: 1
feed_recent:
label: Atom
outfile: atom.xml
build_type: 1
rsd:
label: RSD
outfile: rsd.xml
build_type: 1
rss:
label: RSS
outfile: rss.xml
build_type: 1
archive:
entry_listing:
label: Entry Listing
mappings:
monthly:
archive_type: Monthly
category:
archive_type: Category
category_monthly:
archive_type: Category-Monthly
individual:
entry:
label: Entry
mappings:
entry_archive:
archive_type: Individual
page:
page:
label: Page
mappings:
page_archive:
archive_type: Page
module:
header:
label: Header
footer:
label: Footer
communication:
label: Communication
comment_form:
label: Comment Form
comments:
label: Comments
metadata:
label: Metadata
entry_summary:
label: Entry Summary
sidebar_left:
label: Sidebar Left
sidebar_right:
label: Sidebar Right
trackbacks:
label: TrackBacks
system:
comment_preview:
label: Comment Preview
comment_response:
label: Comment Response
dynamic_error:
label: Dynamic Error
popup_image:
label: Popup Image
search_results:
label: Search Results
widgetset:
3column_layout_sidebar_secondary:
order: 1000
label: 3-column layout - Secondary Sidebar
widgets:
- Calendar
- Recent Entries
- Recent Comments
- Recent Trackbacks
3column_layout_sidebar_primary:
order: 1000
label: 3-column layout - Primary Sidebar
widgets:
- Search
- Tag Cloud
- Category Archives
- Current Category Monthly Archives
- Monthly Archives
- Page Listing
- Syndication
- Creative Commons
- Powered By
widget:
widget_templates/calendar:
label: Calendar
widget_templates/category_archive_list:
label: Category Archives
widget_templates/creative_commons:
label: Creative Commons
widget_templates/current_category_monthly_archive_list:
label: Current Category Monthly Archives
widget_templates/monthly_archive_list:
label: Monthly Archives
widget_templates/pages_list:
label: Page Listing
widget_templates/powered_by:
label: Powered By
widget_templates/recent_comments:
label: Recent Comments
widget_templates/recent_entries:
label: Recent Entries
widget_templates/recent_trackbacks:
label: Recent Trackbacks
widget_templates/search:
label: Search
widget_templates/syndication:
label: Syndication
widget_templates/tag_cloud:
label: Tag Cloud
config.pl
package MT::Plugin::SampleTemplateSet;
use strict;
use base qw( MT::Plugin );
our $VERSION = '0.01';
my $plugin = MT::Plugin::SampleTemplateSet->new({
name => 'Sample Template Set',
version => $VERSION,
description => 'Sample Templateset Description.',
author_name => 'foo',
author_link => 'http://user-domain/',
plugin_link => 'http://user-domain/plugin.html',
doc_link => 'http://user-domain/sample.html',
l10n_class => 'SampleTemplateSet::L10N',
});
MT->add_plugin($plugin);
sub init_registry {
my $plugin = shift;
$plugin->registry({
template_sets => {
SampleTemplateSet => {
label => "Sample Template Set",
base_path => 'templates/',
order => 100,
templates => {
index => {
'main_index' => {
label => 'Main Index',
outfile => 'index.html',
build_type => 1,
},
'archive_index' => {
label => 'Archive Index',
outfile => 'archives.html',
build_type => 1,
},
'styles' => {
label => 'Stylesheet',
outfile => 'styles.css',
build_type => 1,
},
'javascript' => {
label => 'JavaScript',
outfile => 'mt.js',
build_type => 1,
},
'feed_recent' => {
label => 'Atom',
outfile => 'atom.xml',
build_type => 1,
},
'rsd' => {
label => 'RSD',
outfile => 'rsd.xml',
build_type => 1,
},
'rss' => {
label => 'RSS',
outfile => 'rss.xml',
build_type => 1,
},
},
individual => {
'entry' => {
label => 'Entry',
mappings => {
entry_archive => {
archive_type => 'Individual',
},
},
},
'page' => {
label => 'Page',
mappings => {
page_archive => {
archive_type => 'Page',
},
},
},
},
archive => {
'entry_listing' => {
label => $plugin->translate('Entry Listing'),
mappings => {
monthly => {
archive_type => 'Monthly',
},
category => {
archive_type => 'Category',
},
},
},
},
system => {
'comment_response' => {
label => 'Comment Response',
},
'comment_preview' => {
label => 'Comment Preview',
},
'dynamic_error' => {
label => 'Dynamic Error',
},
'popup_image' => {
label => 'Popup Image',
},
'search_results' => {
label => 'Search Results',
},
},
module => {
'communication' => {
label => $plugin->translate('Communication'),
},
'comment_form' => {
label => 'Comment Form',
},
'entry_summary' => {
label => 'Entry Summary',
},
'footer' => {
label => $plugin->translate('Footer'),
},
'header' => {
label => $plugin->translate('Header'),
},
'metadata' => {
label => $plugin->translate('Metadata'),
},
'sidebar_left' => {
label => $plugin->translate('Sidebar Left'),
},
'sidebar_right' => {
label => $plugin->translate('Sidebar Right'),
},
'comments' => {
label => 'Comments',
},
'trackbacks' => {
label => 'Trackbacks',
},
},
'widgetset' => {
'3column_layout_left_sidebar' => {
order => 1000,
label => '3-column layout - Secondary Sidebar',
widgets => [
'Calendar',
'Recent Entries',
'Recent Comments',
$plugin->translate('Recent Trackbacks'),
],
},
'3column_layout_right_sidebar' => {
order => 1000,
label => '3-column layout - Primary Sidebar',
widgets => [
'Search',
'Tag Cloud',
'Category Archives',
$plugin->translate('Current Category Monthly Archives'),
'Monthly Archives',
'Page Listing',
'Syndication',
'Creative Commons',
'Powered By',
],
},
},
widget => {
'widget_templates/calendar' => {
label => 'Calendar',
},
'widget_templates/category_archive_list' => {
label => 'Category Archives',
},
'widget_templates/creative_commons' => {
label => 'Creative Commons',
},
'widget_templates/current_category_monthly_archive_list' => {
label => 'Current Category Monthly Archives',
},
'widget_templates/monthly_archive_list' => {
label => 'Monthly Archives',
},
'widget_templates/pages_list' => {
label => 'Page Listing',
},
'widget_templates/powered_by' => {
label => 'Powered By',
},
'widget_templates/recent_comments' => {
label => 'Recent Comments',
},
'widget_templates/recent_entries' => {
label => 'Recent Entries',
},
'widget_templates/recent_trackbacks' => {
label => $plugin->translate('Recent Trackbacks'),
},
'widget_templates/search' => {
label => 'Search',
},
'widget_templates/syndication' => {
label => 'Syndication',
},
'widget_templates/tag_cloud' => {
label => 'Tag Cloud',
},
},
},
},
},
});
}
1;
ja.pm
package SampleTemplateSet::L10N::ja;
use strict;
use base 'SampleTemplateSet::L10N::en_us';
use vars qw( %Lexicon );
%Lexicon = (
'Sample Template Set' => 'サンプルテンプレートセット',
'Main Index' => 'メインページ',
'Stylesheet' => 'スタイルシート',
'Entry' => 'ブログ記事',
'Page' => 'ウェブページ',
'Entry Listing' => 'ブログ記事リスト',
'Comment Preview' => 'コメントプレビュー',
'Comment Response' => 'コメント完了',
'Communication' => 'コミュニケーション',
'Dynamic Error' => 'ダイナミックパブリッシングエラー',
'Popup Image' => 'ポップアップ画像',
'Search Results' => '検索結果',
'Comment Form' => 'コメント入力フォーム',
'Comments' => 'コメント',
'Metadata' => 'メタデータ',
'Entry Summary' => 'ブログ記事の概要',
'Footer' => 'フッター',
'Header' => 'ヘッダー',
'Sidebar Left' => 'サイドバー左',
'Sidebar Right' => 'サイドバー右',
'3-column layout - Primary Sidebar' => '3カラムのサイドバー(メイン)',
'3-column layout - Secondary Sidebar' => '3カラムのサイドバー(サブ)',
'Calendar' => 'カレンダー',
'Recent Entries' => '最近のブログ記事',
'Recent Comments' => '最近のコメント',
'Recent Trackbacks' => '最近のトラックバック',
'Search' => '検索',
'Tag Cloud' => 'タグクラウド',
'Category Archives' => 'カテゴリアーカイブ',
'Current Category Monthly Archives' => '月別カテゴリアーカイブ',
'Monthly Archives' => '月別アーカイブ',
'Page Listing' => 'ページ一覧',
'Syndication' => '購読',
'Creative Commons' => 'クリエイティブ・コモンズ',
'Powered By' => 'Powered By',
);
1;
en_us.pm
package SampleTemplateSet::L10N::en_us;
use strict;
use base 'SampleTemplateSet::L10N';
use vars qw( %Lexicon );
%Lexicon = ();
1;
L10N.pm
package SampleTemplateSet::L10N;
use strict;
use base 'MT::L10N';
sub init {
my $lh = shift;
$lh->SUPER::init(@_);
$lh->fail_with('mt_fallback');
return;
}
sub mt_fallback {
my $lh = shift;
MT->language_handle->maketext(@_);
}
sub get_handle {
my $this = shift;
my ($lang) = @_;
my $lh;
eval { $lh = $this->SUPER::get_handle($lang) ||
$this->SUPER::get_handle('en_us'); };
if (!$@ && $lh) {
return $lh;
}
return MT->language_handle;
}
1;
テンプレートセット用の資材(背景画像・フィードアイコン)
注:展開してご利用ください。