Skip to content

Commit

Permalink
DKF-638: added "generateRobotsFile" configuration setting to Sitecore…
Browse files Browse the repository at this point in the history
… SiteMapXML.
  • Loading branch information
hloken committed Oct 28, 2013
1 parent c65fddb commit 3d8405e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions App_Config/Include/SitemapXML.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<sitemapVariable name="database" value="web" />
<sitemapVariable name="sitemapConfigurationItemPath" value="/sitecore/system/Modules/Sitemap XML/Sitemap configuration" />
<sitemapVariable name="productionEnvironment" value="false" />
<sitemapVariable name="generateRobotsFile" value="true" />
<sites>
<!--
serverUrl: (optional) will be used to generate url in sitemap file.
Expand Down
2 changes: 2 additions & 0 deletions sitecore modules/Shell/sitemap XML/Classes/SitemapManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ public bool SubmitSitemapToSearchenginesByHttp()

public void RegisterSitemapToRobotsFile()
{
if (!SitemapManagerConfiguration.GenerateRobotsFile)
return;

string robotsPath = MainUtil.MapPath(string.Concat("/", "robots.txt"));
StringBuilder sitemapContent = new StringBuilder(string.Empty);
Expand Down
12 changes: 12 additions & 0 deletions sitecore modules/Shell/sitemap XML/SitemapManagerConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ public static bool IsProductionEnvironment
return !string.IsNullOrEmpty(production) && (production.ToLower() == "true" || production == "1");
}
}

public static bool GenerateRobotsFile
{
get
{
var generateRobotsFile = GetValueByName("generateRobotsFile");

// Defaults to true if setting is missing from config
return string.IsNullOrEmpty(generateRobotsFile) || (generateRobotsFile.ToLower() == "true" || generateRobotsFile == "1");
}
}

#endregion properties

private static string GetValueByName(string name)
Expand Down

0 comments on commit 3d8405e

Please sign in to comment.