====== RSSフィードの作成 ======
RSSフィードの作成には[[web:modx:revolution:addons:getresources|getResources]]を使用します。
===== RSSフィード用ページの作成 =====
- 新しいドキュメントを作成して、タイトルとAliasを設定します。
- 使用テンプレートを(empty)に変更します。
- ページ設定タブに移動して、コンテンツタイプをRSSに変更します。
- 以下をリソースコンテンツに貼り付けます。
[[*pagetitle:htmlent]]
[[~[[*id]]? &scheme=`full`]]
[[*introtext:cdata]]
[[++cultureKey]]
120
[[getResources?
&tpl=`rssItem_tpl`
&parents=`29,41`
&depth=`5`
&limit=`10`
&includeContent=`1`
&includeTVs=`1`
&showHidden=`0`
&hideContainers=`1`
]]
===== getResourcesのテンプレートの作成 =====
前述のコードで getResources は rssItem_tpl というテンプレートを参照していますので、rssItem_tpl と言う名前でchunkを作成します。
テンプレートの中身は以下の通りです。
-
[[+pagetitle:htmlent]]
[[++site_url]][[~[[+id]]]]
[[+introtext:default=`[[+content:ellipsis=`600`]]`:cdata]]
[[+publishedon:strtotime:date=`%a, %d %b %Y %H:%M:%S +0900`]]
[[++site_url]][[~[[+id]]]]
[[+createdby:userinfo=`fullname`]]
* タイトルはpagetitleが使用されています
* Linkはリソースを指しています。
* descriptionはintrotextですが、デフォルトではコンテンツの先頭600文字が使用されます
* 日付は公開日を使用しています。
* GUID はリソースを指しています。
===== Linkの作成 =====
以下の行をheaderに追加することで、RSSアイコンがアドレスバーに表示されます。
実際に使用しているのが、こちらの[[http://www.rookie-inc.com/rssfeed.rss|株式会社ルーキー/RSS フィード]]、[[http://www.rookie-touch.com/rssfeed.rss|ルーキータッチ/RSSフィード]]ページです