private void WriteRssChannelCommonElements(XmlWriter writer)
{
// ------------------------------------------------------------
// Write optional channel elements
// ------------------------------------------------------------
// var url = Utils.FeedUrl;
// if (HttpContext.Current != null)
// {
// url = HttpContext.Current.Request.Url.ToString();
// }
writer.WriteElementString("docs", "http://www.rssboard.org/rss-specification");
writer.WriteElementString("generator", string.Format("BlogEngine.NET {0}", BlogSettings.Instance.Version()));
// writer.WriteRaw("\n<atom:link href=\"" + url + "\" rel=\"self\" type=\"application/rss+xml\" />");
if (!String.IsNullOrEmpty(this.Settings.Language))
{
writer.WriteElementString("language", this.Settings.Language);
}
// ------------------------------------------------------------
// Write blogChannel syndication extension elements
// ------------------------------------------------------------
Uri blogRoll;
if (Uri.TryCreate(
String.Concat(Utils.AbsoluteWebRoot.ToString().TrimEnd('/'), "/opml.axd"),
UriKind.RelativeOrAbsolute,
out blogRoll))
{
writer.WriteElementString(
"blogChannel", "blogRoll", "http://backend.userland.com/blogChannelModule", blogRoll.ToString());
}
if (!String.IsNullOrEmpty(this.Settings.Endorsement))
{
Uri blink;
if (Uri.TryCreate(this.Settings.Endorsement, UriKind.RelativeOrAbsolute, out blink))
{
writer.WriteElementString(
"blogChannel", "blink", "http://backend.userland.com/blogChannelModule", blink.ToString());
}
}
// ------------------------------------------------------------
// Write Dublin Core syndication extension elements
// ------------------------------------------------------------
if (!String.IsNullOrEmpty(this.Settings.AuthorName))
{
writer.WriteElementString("dc", "creator", "http://purl.org/dc/elements/1.1/", this.Settings.AuthorName);
}
// if (!String.IsNullOrEmpty(this.Settings.Description))
// {
// writer.WriteElementString("dc", "description", "http://purl.org/dc/elements/1.1/", this.Settings.Description);
// }
if (!String.IsNullOrEmpty(this.Settings.Name))
{
writer.WriteElementString("dc", "title", "http://purl.org/dc/elements/1.1/", this.Settings.Name);
}
// ------------------------------------------------------------
// Write basic geo-coding syndication extension elements
// ------------------------------------------------------------
var decimalFormatInfo = new NumberFormatInfo { NumberDecimalDigits = 6 };
if (this.Settings.GeocodingLatitude != Single.MinValue)
{
writer.WriteElementString(
"geo",
"lat",
"http://www.w3.org/2003/01/geo/wgs84_pos#",
this.Settings.GeocodingLatitude.ToString("N", decimalFormatInfo));
}
if (this.Settings.GeocodingLongitude != Single.MinValue)
{
writer.WriteElementString(
"geo",
"long",
"http://www.w3.org/2003/01/geo/wgs84_pos#",
this.Settings.GeocodingLongitude.ToString("N", decimalFormatInfo));
}
}