diff --git a/AssemblyVersion.cs b/AssemblyVersion.cs
index a5e835a..0ffda7e 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.5.609")]
-[assembly: AssemblyFileVersion("3.0.5.609")]
\ No newline at end of file
+[assembly: AssemblyVersion("3.0.5.610")]
+[assembly: AssemblyFileVersion("3.0.5.610")]
\ No newline at end of file
diff --git a/Core/Tools.cs b/Core/Tools.cs
index 5438129..6f41d5c 100644
--- a/Core/Tools.cs
+++ b/Core/Tools.cs
@@ -103,6 +103,24 @@ namespace ScrewTurn.Wiki {
return buffer.ToString();
}
+ ///
+ /// Gets the canonical URL tag for a page.
+ ///
+ /// The request URL.
+ /// The current page.
+ /// The namespace.
+ /// The canonical URL, or an empty string if is already canonical.
+ public static string GetCanonicalUrlTag(string requestUrl, PageInfo currentPage, NamespaceInfo nspace) {
+ string url = "";
+ if(nspace == null && currentPage.FullName == Settings.DefaultPage) url = Settings.GetMainUrl().ToString();
+ else url = Settings.GetMainUrl() + "/" + currentPage.FullName + Settings.PageExtension;
+ url = url.Replace("//", "/");
+
+ // Case sensitive
+ if(url == requestUrl) return "";
+ else return "";
+ }
+
///
/// Converts a byte number into a string, formatted using KB, MB or GB.
///
diff --git a/WebApplication/Default.aspx.cs b/WebApplication/Default.aspx.cs
index 2a89657..4296f4d 100644
--- a/WebApplication/Default.aspx.cs
+++ b/WebApplication/Default.aspx.cs
@@ -81,6 +81,12 @@ namespace ScrewTurn.Wiki {
SetupEmailNotification();
SetupPageContent(canPostDiscussion, canManageDiscussion);
+
+ if(currentPage != null) {
+ Literal canonical = new Literal();
+ canonical.Text = Tools.GetCanonicalUrlTag(Request.Url.ToString(), currentPage, Pages.FindNamespace(NameTools.GetNamespace(currentPage.FullName)));
+ Page.Header.Controls.Add(canonical);
+ }
}
///
diff --git a/WebApplication/MasterPage.master.cs b/WebApplication/MasterPage.master.cs
index 7cb7154..93bf28c 100644
--- a/WebApplication/MasterPage.master.cs
+++ b/WebApplication/MasterPage.master.cs
@@ -17,7 +17,7 @@ using ScrewTurn.Wiki.PluginFramework;
namespace ScrewTurn.Wiki {
- public partial class MasterPage : System.Web.UI.MasterPage {
+ public partial class MasterPage : System.Web.UI.MasterPage {
private string currentNamespace = null;
private PageInfo currentPage = null;
@@ -98,12 +98,12 @@ namespace ScrewTurn.Wiki {
Literal c = new Literal();
c.Text = h.Replace("######______INCLUDES______######", Tools.GetIncludes(currentNamespace)).Replace("######______NAMESPACE______######", nspace);
Page.Header.Controls.Add(c);
- }
+ }
///
/// Prints the header.
///
- public void PrintHeader() {
+ public void PrintHeader() {
string h = Content.GetPseudoCacheValue(GetPseudoCacheItemName("Header"));
if(h == null) {
h = FormattingPipeline.FormatWithPhase1And2(Settings.Provider.GetMetaDataItem(MetaDataItem.Header, currentNamespace),
@@ -111,12 +111,12 @@ namespace ScrewTurn.Wiki {
Content.SetPseudoCacheValue(GetPseudoCacheItemName("Header"), h);
}
lblHeaderDiv.Text = FormattingPipeline.FormatWithPhase3(h, FormattingContext.Header, currentPage);
- }
+ }
///
/// Prints the sidebar.
///
- public void PrintSidebar() {
+ public void PrintSidebar() {
string s = Content.GetPseudoCacheValue(GetPseudoCacheItemName("Sidebar"));
if(s == null) {
s = FormattingPipeline.FormatWithPhase1And2(Settings.Provider.GetMetaDataItem(MetaDataItem.Sidebar, currentNamespace),
@@ -124,7 +124,7 @@ namespace ScrewTurn.Wiki {
Content.SetPseudoCacheValue(GetPseudoCacheItemName("Sidebar"), s);
}
lblSidebarDiv.Text = FormattingPipeline.FormatWithPhase3(s, FormattingContext.Sidebar, currentPage);
- }
+ }
///
/// Prints the footer.
diff --git a/WebApplication/Print.aspx.cs b/WebApplication/Print.aspx.cs
index c683898..cef53d1 100644
--- a/WebApplication/Print.aspx.cs
+++ b/WebApplication/Print.aspx.cs
@@ -39,9 +39,13 @@ namespace ScrewTurn.Wiki {
content = Content.GetPageContent(page, true);
+ Literal canonical = new Literal();
+ canonical.Text = Tools.GetCanonicalUrlTag(Request.Url.ToString(), page, Pages.FindNamespace(NameTools.GetNamespace(page.FullName)));
+ Page.Header.Controls.Add(canonical);
+
Page.Title = FormattingPipeline.PrepareTitle(content.Title, false, FormattingContext.PageContent, page) + " - " + Settings.WikiTitle;
- PrintContent();
+ PrintContent();
}
///