简体   繁体   English

在SyndicationFeed中按类别选择项目

[英]Select items by category in SyndicationFeed

I am using the .NET SyndicationFeed to create my own RSS website feed. 我正在使用.NET SyndicationFeed创建自己的RSS网站供稿。 No problem creating it and displaying all of them but I have not quite figure out how to select all the news items in the feed that have a specific category. 创建它并显示所有内容都没问题,但是我还不太清楚如何选择Feed中具有特定类别的所有新闻项。

For example all items that have been categorized in SyndicationItem.Category with "Art". 例如,已在SyndicationItem.Category中用“艺术品”分类的所有物品。 I want to display them in an MVC view where I have a dropdown list where the categories can be selected. 我想在MVC视图中显示它们,在该视图中有一个可以选择类别的下拉列表。

I've faced a similar problem with a website and it's rss feed. 我的网站也遇到了类似的问题,这是RSS提要。 The solution I found was going through the feed of the category page. 我发现的解决方案是通过类别页面的提要。 Let's say the url is www.mywebsite.com/feed , and when I want the posts categorized within 'Art', I go to www.mywebsite.com/category/art/feed and there I got all the posts under that category. 假设该网址为www.mywebsite.com/feed ,当我希望将帖子分类为“艺术”类别时,我转到www.mywebsite.com/category/art/feed ,在那里我看到了所有该类别的帖子。

The issue would be determining the url form where you can find every category posts because it's different from website to website ( www.url.com/category/catName or www.url.com/section/catName for example) 问题在于确定url形式,您可以在其中找到每个类别的帖子,因为它在网站之间是不同的(例如www.url.com/category/catNamewww.url.com/section/catName

And the other problem is, I did not find a feed for the categories list to populate the dropdown list you mention, so I had to do it manually. 另一个问题是,我没有找到类别列表的提要来填充您提到的下拉列表,所以我不得不手动进行操作。

I know it's not a definite answer but I hope it helps. 我知道这不是一个确定的答案,但希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM