Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply /reference path replacements to search index build scripts. #488

Merged

Conversation

mayaarguelles
Copy link

@mayaarguelles mayaarguelles commented Aug 15, 2024

This resolves #485, which was caused by the paths of items in subfolders of the reference directory being modified in the Astro router but not in the search index build scripts generating the relative URLs to each search result. To address this, I've moved the string replacement previously happening in normalizeReferenceRoute to a separate function which I then used in the search index build scripts to apply the same transformation.

One small caveat — I had trouble importing any function from the pages/_utils.ts file in the search build script due to the astro:content dependencies included in that file, so I moved this function to the pages/_utils-node.ts file, which is probably not a huge deal but maybe worth noting as it doesn't technically rely on any runtime node dependencies. With the function in the pages/_utils.ts file the build would work perfectly through the total npm run build/astro build, but fail on the independent npm run build:search with the message:

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. Received protocol 'astro:'

Moving the function to the other utils file solved this, and this standardization solves the issue with the links to any items from the constants or types section 404ing, but maybe I'm missing an easier way that would let that function live in the same file it's getting used for the router and still be imported to the search builder.

Copy link
Collaborator

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@davepagurek davepagurek merged commit 1cf4ae9 into processing:main Aug 15, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

404 error when looking up references for WEBGL, WEBGL2
2 participants