Skip to content

Commit d860b5d

Browse files
Jen-UnoCopilot
andauthored
fix: Update doc/templates/uno/component/affix.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 35fd8b2 commit d860b5d

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

doc/templates/uno/component/affix.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,25 @@ function renderAffix() {
2727
if (contributionList.length > 0) {
2828
const pageUrl = encodeURIComponent(window.location.href);
2929
const issueTitle = encodeURIComponent(`[Docs] Feedback: ${document.title}`);
30-
const issueUrl = `https://github.com/unoplatform/uno/issues/new?template=documentation-issue.yml&title=${issueTitle}&docs-issue-location=${pageUrl}`;
3130

32-
// Add icon to "Edit this page"
31+
// Derive GitHub repository path from the "Edit this page" link when possible,
32+
// falling back to the main Uno repository for backward compatibility.
33+
let repoPath = 'unoplatform/uno';
34+
3335
const editLink = contributionList.find('li a.contribution-link');
36+
if (editLink.length > 0) {
37+
const editHref = editLink.attr('href');
38+
if (editHref) {
39+
const repoMatch = editHref.match(/github\.com\/([^\/]+\/[^\/]+)/i);
40+
if (repoMatch && repoMatch[1]) {
41+
repoPath = repoMatch[1];
42+
}
43+
}
44+
}
45+
46+
const issueUrl = `https://github.com/${repoPath}/issues/new?template=documentation-issue.yml&title=${issueTitle}&docs-issue-location=${pageUrl}`;
47+
48+
// Add icon to "Edit this page"
3449
if (editLink.length > 0) {
3550
editLink.prepend('<i class="fa fa-edit"></i> ');
3651
}

0 commit comments

Comments
 (0)