it works on my end
quality not guaranteed
add plugin for checking broken links #39
check_links into main it works with resolve_urls
nice!
This loop is executed for every url found in the html code. It should be moved outside this function and run only once. For example:
const urls = new Set<string>(); // Set is more performant than arrays
site.process("*", (pages) => {
url.clear(); // Clear on rebuild
for (const page of pages) {
urls.add(site.url(page.data.url, true)); // site.url() return the full url if the second argument is true
}
for (const file of site.files) {
urls.add(site.url(file.outputPath, true));
}
});
site.use(modifyUrls({
// Use the urls
})
should still merge modify_urls.ts into this
nice! Can I merge it?
new, new finding! Add this in documentation:
this plugin must be put after resolve_urls and relative_urls, or it will report false broken links. ideally, put it as the last plugin.
nice! Can I merge it?
you can merge it now.
more ux
this plugin is great. while muffet will turn a blind eye to /a -> /a/, this plugin will not.
it also checks if files by site.copy is... i guess i found another bug?
the issue is, let's say i have a file a.md that is referenced in index.md as [a](./a.md).
i have site.copy('a.md').
i have site.use(resolve_urls()).
resolve_urls will rewrite the url to /a/index.html (wtf?)
maybe site.copy should auto call site.ignore
resolve_urls doesn't replace urls for pages that don't exist.
If you copy a.md, you should have a.md in your dest folder.
the issue is, let's say i have a file a.md that is referenced in index.md as a.
Okay, I just reproduced this issue. It's a bug, will fix it.
Sorry, I merged this PR without reviewing the code (I thought you only made my previous suggestions).
Why did you copy the code from modify_urls to this plugin?
Why did you copy the code from modify_urls to this plugin?
modify_urls uses node.setAttribute while this plugin doesn't. might be faster.
Ah, okay.
If this plugin is merged in Lume repo, maybe it's a good idea to move this logic to a external function shared by both plugins to remove duplicated code.
Ah, okay. If this plugin is merged in Lume repo, maybe it's a good idea to move this logic to a external function shared by both plugins to remove duplicated code.
maybe you can add a comment at the top of the file for this.
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?