Closed EnesDONER closed 2 weeks ago
hi @EnesDONER
I wrote a link checker. here are source code and results:
// See https://aka.ms/new-console-template for more information
using System.Text.RegularExpressions;
var baseDir = "/Users/maliming/Github/abp/docs/en/";
var mdFiles = Directory.GetFiles(baseDir, "*.md", SearchOption.AllDirectories);
var count = 0;
foreach (var file in mdFiles.Where(x => !x.Contains("_deleted") && !x.Contains("Blog-Posts")))
{
var regex = new Regex(@"\[[^\[\]]*\]\(((?!http)[^\(\)]*)\)");
var content = File.ReadAllText(file);
var matches = regex.Matches(content);
foreach (Match match in matches)
{
var url = match.Groups[1].Value;
if (!string.IsNullOrWhiteSpace(url) && !url.StartsWith("#"))
{
var newUrl = url;
var parent = file;
if (newUrl.StartsWith("./"))
{
parent = Path.GetDirectoryName(parent);
newUrl = Path.Combine(parent, url.Replace("./", ""));
}
else if (newUrl.StartsWith("../"))
{
var count2 = Regex.Count(newUrl, @"\.\./");
for (var i = 0; i <= count2; i++)
{
parent = Path.GetDirectoryName(parent);
}
newUrl = Path.Combine(parent, url.Replace("../", ""));
}
else
{
newUrl = Path.Combine(Path.GetDirectoryName(parent), url);
}
if (newUrl.Contains("?"))
{
newUrl = newUrl.Substring(0, newUrl.IndexOf("?"));
}
if (!File.Exists(newUrl) && !File.Exists(Path.Combine(newUrl, "index.md")) && !File.Exists(newUrl + ".md"))
{
Console.WriteLine($"File : {file.Replace(baseDir, "")}");
Console.WriteLine($"Url : {url}");
//Console.WriteLine($"New Url : {newUrl}");
Console.WriteLine($"File not exists: {newUrl.Replace(baseDir, "")}");
Console.WriteLine("----------------------------------");
count++;
}
}
}
}
Console.WriteLine("Wrong Count: " + count);
File : Deploy-azure-app-service.md
Url : images/azdevops-23.png
File not exists: images/azdevops-23.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-1.png
File not exists: images/azdevops-1.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-2.png
File not exists: images/azdevops-2.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-18.png
File not exists: images/azdevops-18.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-3.png
File not exists: images/azdevops-3.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-4.png
File not exists: images/azdevops-4.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-5.png
File not exists: images/azdevops-5.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-6.png
File not exists: images/azdevops-6.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-7.png
File not exists: images/azdevops-7.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-8.png
File not exists: images/azdevops-8.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-9.png
File not exists: images/azdevops-9.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-10.png
File not exists: images/azdevops-10.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-11.png
File not exists: images/azdevops-11.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-12.png
File not exists: images/azdevops-12.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-13.png
File not exists: images/azdevops-13.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-14.png
File not exists: images/azdevops-14.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-19.png
File not exists: images/azdevops-19.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-20.png
File not exists: images/azdevops-20.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-21.png
File not exists: images/azdevops-21.png
----------------------------------
Some results are deleted.
----------------------------------
File : solution-templates/single-layer-web-application/index.md
Url : Application.md
File not exists: solution-templates/single-layer-web-application/Application.md
----------------------------------
File : solution-templates/single-layer-web-application/index.md
Url : ../Domain-Driven-Design.md
File not exists: solution-templates/Domain-Driven-Design.md
----------------------------------
File : solution-templates/single-layer-web-application/index.md
Url : Application.md
File not exists: solution-templates/single-layer-web-application/Application.md
----------------------------------
File : solution-templates/single-layer-web-application/index.md
Url : ../CLI.md
File not exists: solution-templates/CLI.md
File : tutorials/book-store/part-08.md
Url : Part-1.md
File not exists: tutorials/book-store/Part-1.md
----------------------------------
File : tutorials/book-store/part-08.md
Url : Part-2.md
File not exists: tutorials/book-store/Part-2.md
----------------------------------
File : tutorials/book-store/part-08.md
Url : Part-3.md
File not exists: tutorials/book-store/Part-3.md
----------------------------------
File : tutorials/book-store/part-08.md
Url : Part-4.md
File not exists: tutorials/book-store/Part-4.md
File : framework/ui/blazor/Localization.md
Url : ../../Localization.md
File not exists: framework/Localization.md
----------------------------------
File : framework/ui/blazor/Global-Scripts-Styles.md
Url : ../../CLI.md#bundle
File not exists: framework/CLI.md#bundle
----------------------------------
File : framework/ui/blazor/Global-Scripts-Styles.md
Url : ../../CLI.md#bundle
File not exists: framework/CLI.md#bundle
----------------------------------
File : framework/ui/blazor/Authorization.md
Url : ../../Authorization.md
File not exists: framework/Authorization.md
File : framework/architecture/modularity/extending/overriding-user-interface.md
Url : ../../../ui/blazor/customization-user-interface.md
File not exists: framework/ui/blazor/customization-user-interface.md
----------------------------------
File : framework/architecture/modularity/extending/customizing-application-modules-overriding-services.md
Url : Entities.md
File not exists: framework/architecture/modularity/extending/Entities.md
----------------------------------
File : framework/infrastructure/event-bus/distributed/index.md
Url : Local-Event-Bus.md
File not exists: framework/infrastructure/event-bus/distributed/Local-Event-Bus.md
----------------------------------
Wrong Count: 976
Hi @maliming, this pull request does not change all links. https://github.com/abpframework/abp/pull/19631 needs to be merged with this pull request. Merging with this will eliminate the problems.
TODO: Abp docs broken links fixed