-using RssFeedGenerator;
+using OpenGraphNet;
+using RssFeedGenerator;
using System;
using System.Collections.Generic;
using System.IO;
foreach (var file in fileInfos)
{
+ var htmlString = File.ReadAllText(file.FullName);
+ OpenGraph graph = OpenGraph.ParseHtml(htmlString);
var item = new rssChannelItem()
{
- title = Path.GetFileNameWithoutExtension(file.Name),
+ title = graph.Title,
+ description = graph.Metadata["og:description"].First(),
pubDate = file.CreationTimeUtc.ToString("r"),
};
if (file.FullName.Contains("entries"))
var output = Generator.SerializeRSS(myRSS);
-var rssPath = Path.Combine(Directory.GetCurrentDirectory(), "../../../../feed.xml");
+var rssPath = String.Empty;
+
+if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+{
+ rssPath = Path.Combine(Directory.GetCurrentDirectory(), "../feed.xml");
+}
+else
+{
+ rssPath = Path.Combine(Directory.GetCurrentDirectory(), "../../../../feed.xml");
+}
if (File.Exists(rssPath))
{