diff --git a/AssemblyVersion.cs b/AssemblyVersion.cs index 1fb0ba6..8fd6b82 100644 --- a/AssemblyVersion.cs +++ b/AssemblyVersion.cs @@ -16,5 +16,5 @@ using System.Reflection; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.1.404")] -[assembly: AssemblyFileVersion("3.0.1.404")] +[assembly: AssemblyVersion("3.0.1.405")] +[assembly: AssemblyFileVersion("3.0.1.405")] diff --git a/WebApplication/Sitemap.aspx b/WebApplication/Sitemap.aspx new file mode 100644 index 0000000..8fdc906 --- /dev/null +++ b/WebApplication/Sitemap.aspx @@ -0,0 +1 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Sitemap.aspx.cs" Inherits="ScrewTurn.Wiki.Sitemap" %> diff --git a/WebApplication/Sitemap.aspx.cs b/WebApplication/Sitemap.aspx.cs new file mode 100644 index 0000000..48d86d1 --- /dev/null +++ b/WebApplication/Sitemap.aspx.cs @@ -0,0 +1,58 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Xml; +using ScrewTurn.Wiki.PluginFramework; + +namespace ScrewTurn.Wiki { + + public partial class Sitemap : System.Web.UI.Page { + + protected void Page_Load(object sender, EventArgs e) { + Response.ClearContent(); + Response.ContentType = "text/xml;charset=UTF-8"; + Response.ContentEncoding = System.Text.UTF8Encoding.UTF8; + + string mainUrl = Settings.MainUrl; + + using(XmlWriter writer = XmlWriter.Create(Response.OutputStream)) { + writer.WriteStartDocument(); + + writer.WriteStartElement("urlset"); + writer.WriteAttributeString("schemaLocation", "xsi", "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/09/sitemap.xsd"); + + foreach(PageInfo page in Pages.GetPages(null)) { + WritePage(mainUrl, page, writer); + } + foreach(NamespaceInfo nspace in Pages.GetNamespaces()) { + foreach(PageInfo page in Pages.GetPages(nspace)) { + WritePage(mainUrl, page, writer); + } + } + + writer.WriteEndElement(); + writer.WriteEndDocument(); + } + } + + /// + /// Writes a page to the output XML writer. + /// + /// The main wiki URL. + /// The page. + /// The writer. + private void WritePage(string mainUrl, PageInfo page, XmlWriter writer) { + writer.WriteStartElement("url"); + writer.WriteElementString("loc", mainUrl + Tools.UrlEncode(page.FullName) + Settings.PageExtension); + writer.WriteElementString("priority", "0.5"); + writer.WriteElementString("changefreq", "daily"); + writer.WriteEndElement(); + } + + } + +} diff --git a/WebApplication/Sitemap.aspx.designer.cs b/WebApplication/Sitemap.aspx.designer.cs new file mode 100644 index 0000000..6b98043 --- /dev/null +++ b/WebApplication/Sitemap.aspx.designer.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.4927 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ScrewTurn.Wiki { + + + public partial class Sitemap { + } +} diff --git a/WebApplication/WebApplication.csproj b/WebApplication/WebApplication.csproj index 03acb3c..a5effb0 100644 --- a/WebApplication/WebApplication.csproj +++ b/WebApplication/WebApplication.csproj @@ -581,6 +581,13 @@ SessionRefresh.aspx + + Sitemap.aspx + ASPXCodeBehind + + + Sitemap.aspx + Thumb.aspx ASPXCodeBehind @@ -2363,6 +2370,7 @@ +