SyndicationFeed
Atom フィードの生成に使用しています。
W3C Feed Validation Serviceを使用してフィードを検証する場合を除いて、すべてが機能しているように見えますが、次の警告が表示されます。
このフィードは有効ですが、次の推奨事項を実装することで、さまざまなフィード リーダーとの相互運用性を向上させることができます。行 2、列 0: rel="self" の atom:link がありません
作成したタグに属性を追加するのは簡単ですが、どうすれSyndicationFeed
ば追加できますか? 私はこれのための設定を見ていません。
これが私のフィードの最初の部分です。
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us">
<title type="text">Insider Articles</title>
<subtitle type="text">Insider Articles data feed.</subtitle>
<id>http://www.insiderarticles.com/Syndication/Atom</id>
<rights type="text">Copyright (c) 2016 Insider Articles. All Rights Reserved.</rights>
<updated>2016-10-02T12:47:21-07:00</updated>
<logo>http://www.insiderarticles.com/Content/Images/rss.jpg</logo>
<link rel="alternate" href="http://www.insiderarticles.com/" />
<entry>
<!-- Etc... -->
フィードを作成する方法は次のとおりです (フィード項目を除く)。
// Construct feed
SyndicationFeed feed = new SyndicationFeed(
Properties.Settings.Default.ApplicationName,
Properties.Settings.Default.FeedSummary,
new Uri(Properties.Settings.Default.ApplicationDomainRoot),
string.Format("{0}/Syndication/Atom", Properties.Settings.Default.ApplicationDomainRoot),
DateTime.Now);
feed.Language = "en-us";
feed.Copyright = new TextSyndicationContent(Properties.Settings.Default.ApplicationCopyright);
feed.ImageUrl = new Uri(string.Format("{0}/Content/Images/rss.jpg", uriRoot));
feed.Items = items;