Allow external link on the navigation area.

pull/570/head
Halil ibrahim Kalkan 6 years ago
parent bacd3313eb
commit 464713c35d

@ -116,6 +116,11 @@ namespace Volo.Docs.Areas.Documents.Helpers.TagHelpers
private string NormalizePath(string path, bool hasChildItems)
{
if (IsExternalLink(path))
{
return path;
}
var pathWithoutFileExtension = RemoveFileExtensionFromPath(path);
if (string.IsNullOrWhiteSpace(path))
@ -126,6 +131,16 @@ namespace Volo.Docs.Areas.Documents.Helpers.TagHelpers
return "/documents/" + ProjectName + "/" + Version + "/" + pathWithoutFileExtension;
}
protected virtual bool IsExternalLink(string path)
{
if (path.IsNullOrEmpty())
{
return false;
}
return path.StartsWith("http") || path.StartsWith("https");
}
private string RemoveFileExtensionFromPath(string path)
{
if (path == null)
@ -137,6 +152,5 @@ namespace Volo.Docs.Areas.Documents.Helpers.TagHelpers
? path.Left(path.Length - ProjectFormat.Length - 1)
: path;
}
}
}

Loading…
Cancel
Save