RSSは色々と規格が存在するようで、今回は RSS 1.0 と RSS 2.0 に対応するようにします。
portal_skin/custom フォルダにアクセスします。
Content-Type が text/xml ではなく text/html となっているためです。
(画像の右上をチェックしてください。)
Content-Type を text/xml に変更して保存すると、以下のようにエラーメッセージが表示されなくなります。
index.rdf, index.xml という2つのアイテムを作成します。
作成した2つのファイルが配信する内容が、フォーマット的に正しいかを Feed Validator を使用してチェックします。
下記のURLを使ってチェックして、フォーマットに問題がないことを確認しました。
配信対象となるのは、最近公開(published)したアイテムを新しい順に15件としています。 件数や対象とするアイテムの種類を限定したい場合は、両方のソースの下記のアイテムを検索する部分を書き換えてください。:
<tal:search tal:define="results python:here.portal_catalog.searchResults(
sort_on='modified',
sort_order='reverse',
review_state='published')[:15]">
まずは、検索部分について説明します。
[:15] の部分の数字を変更します。portal_type という条件を追加します。
例えば、文書とフォルダのみを対象とする場合は以下のように変更します。:
review_state='published', portal_type=['Document','Folder'])[:15]">
次に、RSS情報へのリンクをHTMLのヘッダに入れるために、ploneのヘッダを定義している部分を変更します。
portal_skins/plone_templates にアクセスします。
header を選択して Customize ボタンをクリックして、編集用に custom フォルダにコピーします。
header に以下のようにRSS情報へのリンクを追加します。変更前:
<!-- Basic crude style for Netscape4.x - This can be removed
if you don't want the special NS4 look - it will still work,
just be plain text instead. Column layout for Netscape4.x included -->
<link rel="Stylesheet" type="text/css" href="" tal:attributes="href string:$portal_url/ploneNS4.css" />
変更後:
<link rel="alternate" type="application/rss+xml" title="RSS 1.0" href=""
tal:attributes="href string:$portal_url/index.rdf" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href=""
tal:attributes="href string:$portal_url/index.xml" />
<!-- Basic crude style for Netscape4.x - This can be removed
if you don't want the special NS4 look - it will still work,
just be plain text instead. Column layout for Netscape4.x included -->
<link rel="Stylesheet" type="text/css" href="" tal:attributes="href string:$portal_url/ploneNS4.css" />