Skip to content

Conversation

@YDX-2147483647
Copy link
Contributor

@YDX-2147483647 YDX-2147483647 commented Sep 5, 2025

The current <SymbolsTemplate> requires the basePath in metadata to be exactly /docs/.
If not, the redirection will lead to 404 Not Found.
For example, go to https://ydx-typst.netlify.app/reference/symbols/ (basePath === '/') and click Next page, and you'll reach https://typst.app/reference/symbols/sym/ instead of https://typst.app/docs/reference/symbols/sym/.

图片

This PR adds support for other kinds of basePath.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes redirection issues in the SymbolsTemplate component when the basePath is not exactly /docs/. It addresses 404 errors that occur when redirecting to the official Typst documentation from sites with different base paths.

  • Adds a new shiftBase utility function that properly handles base path transformation
  • Updates SymbolsTemplate to use the new utility instead of hardcoded URL construction
  • Refactors BaseTemplate to use the same utility for consistency

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
website/src/utils/path.ts Adds shiftBase function to handle base path transformations
website/src/utils/path.test.ts Comprehensive test suite for the new shiftBase function
website/src/components/templates/SymbolsTemplate.tsx Updates redirection logic to use shiftBase utility
website/src/components/templates/BaseTemplate.tsx Refactors to use shiftBase instead of manual path manipulation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@3w36zj6 3w36zj6 left a comment

Choose a reason for hiding this comment

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

LGTM

@3w36zj6 3w36zj6 merged commit e3a07ac into typst-jp:main Sep 5, 2025
5 checks passed
@YDX-2147483647 YDX-2147483647 deleted the sym branch September 5, 2025 13:06
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.

2 participants