nitrojs / nitrojs/nitro

Crawl to prerender routes routes with unknown extension

Open
#1,896 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion prerender v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

From https://github.com/unjs/nitro/issues/1378#issuecomment-1792423273 by @Barbapapazes

Also #1067

Currently prerenderer crawler, only follows up to crawl links that either have no extension /foo/bar or a known extension /foo/bar/test.json (json is only known extension).

If we have a link such as /foo.bar it won't be crawled as .bar is assumed as an unknown extension.

This behavior is to avoid wrongly crawling paths that lead to binary extensions. Mainly public assets such as /favicon.ico which itself is going to be in public directory already but also static .html files.

I think we should improve the implementation by allowing any extension for a tags at least (current regex for crawler is too aggressive and scans for any tag with href attribute) and let the logic disallow overriding public asset files and also skip binary responses to followup crawler.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the prerenderer crawler implementation and its current href-matching regex, then review the behavior described in the linked issues and comment. Define how links in a tags with unknown extensions are followed while public assets and binary responses remain excluded; done means routes such as /foo.bar are crawled without incorrectly crawling asset files.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.