ExpressionEngineのURLからindex.phpを消す (2)
「ExpressionEngineのURLからindex.phpを消す(1)」の続きです。テンプレートを編集して、ExpressionEngineが出力するリンク先のURLからindex.phpとグループ名を除去します。
出力するURLからindex.phpを除去する
ExpressionEngineのテンプレートタグは、標準ではindex.phpを含めたURLを出力します。index.phpを除去して出力するには、[Admin>システムプリファレンス>全体的な構成]で、「サイトのインデックスページの名称」の「index.php」を削除します。
出力するURLからグループ名を除去する
URLからテンプレートのグループ名を削除するには、テンプレートタグを次のように修正します。テンプレートタグについてはまだ細かく調べていないので、ちょっと適当ですが…。
index/archives/commentsテンプレート
| 修正前 | 修正後 | 修正後の出力 | |
|---|---|---|---|
| スタイルシートのURL | {stylesheet= {my_template_group}/site_css} |
{path=site_css} | http://~/site_css/ |
| 記事の個別ページのURL | {title_permalink= {my_template_group}/index} |
{title_permalink} | http://~/記事のタイトル/ |
| コメントページのURL | {url_title_path= “{my_template_group}/comments”} |
{url_title_path= “comments”} |
http://~/comments/記事のタイトル/ |
| カテゴリー別ページのURL | {path={my_template_group}/index} | {path=site_index} | http://~/category/カテゴリー名 |
| 月別ページのURL | {path={my_template_group}/index} | {path=archives} | http://~/archives/2009/04/ |
| すべてのアーカイブのURL | {path={my_template_group}/archives} | {path=archives} | http://~/archives/ |
| AtomのURL | {path={my_template_group}/atom} | {path=atom} | http://~/atom/ |
| RSSのURL | {path={my_template_group}/rss_2.0} | {path=rss_2.0} | http://~/rss_2.0/ |
Atomテンプレート
| 修正前 | 修正後 | 修正後の出力 | |
|---|---|---|---|
| 記事の個別ページのURL | {url_title_path=myblog/index} | {url_title_path} | http://~/記事のタイトル/ |
| カテゴリー別ページのURL | {path=myblog/index} | {path=site_index} | http://~/category/カテゴリー名 |
RSSテンプレート
| 修正前 | 修正後 | 修正後の出力 | |
|---|---|---|---|
| 記事の個別ページのURL | {title_permalink=myblog/index} | {title_permalink} | http://~/記事のタイトル/ |
※{path=hoge}と指定すると「http://ブログURL/hoge」というURLが出力されます。
カテゴリー名をURLに使用する
カテゴリー別ページのURLには、標準ではカテゴリーのID番号が使用されます。カテゴリー名を使ったURLにするには、[Admin>ブログアドミニストレーション>グローバル・ブログ・プリファレンス ]で「カテゴリURLタイトルをリンクに使用しますか? 」を「はい」に設定します。
2009年4月28日 Posted by staff_r | コメント


トラックバックURL: http://blog.kuromatsunai.info/postexpressionengineurlindex-php1/trackback/