Skip to content

Conversation

@bytedream
Copy link
Contributor

Fix #35749.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 27, 2025
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/frontend labels Oct 27, 2025
Copy link
Member

@silverwind silverwind left a comment

Choose a reason for hiding this comment

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

Good find about the JS file tree too.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 27, 2025
@lunny lunny added this to the 1.26.0 milestone Oct 27, 2025
Comment on lines +46 to +51
buildTitle(oldTreePath: string, treePath: string) {
// the title always starts with "<repoName>/<treePath>"
const oldPrefixLength = props.repoName.length + 1 + oldTreePath.length;
const titleSuffix = document.title.substring(oldPrefixLength);
return `${props.repoName}/${treePath}${titleSuffix}`;
},
Copy link
Contributor

@wxiaoguang wxiaoguang Oct 27, 2025

Choose a reason for hiding this comment

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

That's really fragile.

I think backend can fully prepare the "title" (ctx.Data["Title"]), pass it to frontend, and frontend only needs to set it.

Copy link
Contributor

@wxiaoguang wxiaoguang Oct 28, 2025

Choose a reason for hiding this comment

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

The title can be passed from backend to frontend by a HTML attribute, then in loadViewContent, read the title attribute and set it to the current document's title.

By the way, the URL handling in loadViewContent seems also not quite right, could be fixed.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Wrong title & Feature req: Dynamically Update document.title When Navigating Files via File Tree

5 participants