SyndicationFeed不添加rel =“self”属性(SyndicationFeed not adding rel=“self” attribute)
我正在使用
SyndicationFeed
生成Atom提要。我似乎一切正常,除非我使用W3C Feed验证服务来验证我的Feed,我收到以下警告。
此Feed有效,但可以通过实施以下建议来改进与最广泛的Feed阅读器的互操作性。 第2行,第0列:缺少原子:与rel =“self”的链接
将属性添加到我创建的标记中很容易,但是如何让
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... -->
以下是我构建Feed的方式(减去Feed项目)。
// 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;
I'm using
SyndicationFeed
to generate an Atom feed.I seem to have everything working except when I use W3C Feed Validation Service to validate my feed, I get the following warning.
This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations. line 2, column 0: Missing atom:link with rel="self"
It's easy enough to add an attribute to a tag that I created, but how can I get
SyndicationFeed
to add it? I'm not seeing a setting for this.Here is the first part of my feed.
<?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... -->
Here's how I'm constructing my feed (minus the feed items).
// 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;
原文:https://stackoverflow.com/questions/39821046
最满意答案
我看过这个,如果我使用background-image :( someimage.png)或img src ='someimage.png'并不重要,因为图像名称保持不变但是IE缓存图像直到执行强制重载。 因此,我每次都使用以下方法动态更改图像名称。
$str = explode(".", $iFilename); $fName = $str[0] . "_" . mktime() . "." . $str[1]; $this->filename = $fName;
我不确定是否有其他方法可以做到这一点,不涉及更改文件名,所以我愿意接受建议?
I have looked at this and it does not matter if I use the background-image:(someimage.png) or img src='someimage.png' because the image name remains the same but IE caches the image until a force reload is executed. Therefore I have changed the image name dynamically each time by using the following.
$str = explode(".", $iFilename); $fName = $str[0] . "_" . mktime() . "." . $str[1]; $this->filename = $fName;
I am not sure if there is another way of doing this that does not involve changing the filename so I am open to suggestions?
相关问答
更多-
因为content属性与:: before和:: after伪元素一起使用以在文档中生成内容。 http://www.w3.org/wiki/CSS/Properties/content