Skip to content

Commit

Permalink
[FIX] use source file to render editlink
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapio authored and linawolf committed Nov 16, 2024
1 parent 9dc6c95 commit 7ad266f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/typo3-docs-theme/src/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,14 @@ public function getEditOnGitHubLink(array $context): string
return '';
}
$githubBranch = $this->themeSettings->getSettings('edit_on_github_branch', 'main');
$currentFileName = $this->getCurrentFilename($context);
if ($currentFileName === '') {
$sourceFile = $this->getSourceFilename($context);
if ($sourceFile === '') {
return '';
}
$gitHubPerPageLink = $this->getEditOnGitHubLinkPerPage($renderContext);

$githubDirectory = trim($this->themeSettings->getSettings('edit_on_github_directory', 'Documentation'), '/');
return $gitHubPerPageLink ?? sprintf("https://github.com/%s/edit/%s/%s/%s.rst", $githubButton, $githubBranch, $githubDirectory, $currentFileName);
return $gitHubPerPageLink ?? sprintf("https://github.com/%s/edit/%s/%s/%s", $githubButton, $githubBranch, $githubDirectory, $sourceFile);
}

private function getEditOnGitHubLinkPerPage(RenderContext $renderContext): string|null
Expand Down

0 comments on commit 7ad266f

Please sign in to comment.