Skip to content

Conversation

@bgravenorst
Copy link
Contributor

Description

Fix Wallet API Documentation Introduction Link Routing

Problem

The "Introduction" link in the Wallet API documentation sidebar was incorrectly routing to /wallet/index/ instead of /wallet/, causing a "Page not found" error. This was due to the order of operations in the transformItems function where path transformations were being applied in an incorrect sequence.

Changes

  • Fixed the root path handling to correctly point to /wallet/ instead of /wallet/index/

Fixes

Fixes #1854

Preview

Checklist

Complete this checklist before merging your PR:

  • If this PR contains a major change to the documentation content, I have added an entry to the top of the "What's new?" page.
  • The proposed changes have been reviewed and approved by a member of the documentation team.

Signed-off-by: bgravenorst <byron.gravenorst@consensys.net>
Signed-off-by: bgravenorst <byron.gravenorst@consensys.net>
Copilot AI review requested due to automatic review settings June 17, 2025 02:29
@bgravenorst bgravenorst requested review from a team as code owners June 17, 2025 02:29
@vercel
Copy link

vercel bot commented Jun 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
metamask-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 17, 2025 11:18pm

Copy link

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 the sidebar routing issue in the Wallet API documentation by adjusting how URL paths are transformed in the transformItems function.

  • Fix root path handling by converting "/index" endings and "/" to the correct "/wallet/" routes
  • Update code style by standardizing quotes and formatting in the file

Comment on lines +32 to 42
if (!newItem.href.startsWith("/")) {
newItem.href = `/${newItem.href}`;
}
if (newItem.href.endsWith("/index")) {
newItem.href = newItem.href.slice(0, -5);
}
if (!newItem.href.startsWith("/")) {
newItem.href = `/${newItem.href}`;
if (newItem.href === "/") {
newItem.href = "/wallet/";
} else {
newItem.href = `/wallet${newItem.href}`;
}
Copy link

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

Consider consolidating the URL normalization logic in the transformItems function. For clarity, ensure that the decision to always prefix with '/wallet' aligns with handling both absolute and relative paths uniformly.

Suggested change
if (!newItem.href.startsWith("/")) {
newItem.href = `/${newItem.href}`;
}
if (newItem.href.endsWith("/index")) {
newItem.href = newItem.href.slice(0, -5);
}
if (!newItem.href.startsWith("/")) {
newItem.href = `/${newItem.href}`;
if (newItem.href === "/") {
newItem.href = "/wallet/";
} else {
newItem.href = `/wallet${newItem.href}`;
}
newItem.href = normalizeHref(newItem.href);

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@alexandratran alexandratran left a comment

Choose a reason for hiding this comment

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

LGTM

@bgravenorst bgravenorst merged commit b5653eb into main Jun 17, 2025
17 of 18 checks passed
@bgravenorst bgravenorst deleted the DOC-1854 branch June 17, 2025 23:38
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.

Wallet API reference sidebar link issue

3 participants