Skip to content

Commit

Permalink
[BUGFIX] Also apply premalink URI normalization for rstAnchor case
Browse files Browse the repository at this point in the history
Replacing "typo3/cms-xxx" with "typo3-cms-xxx" needs to happen
at an earlier place.
  • Loading branch information
garvinhicking authored and linawolf committed Nov 6, 2024
1 parent fdaec36 commit c137f91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/typo3-docs-theme/assets/js/link-reference-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@
function generateShortUri(linkReferenceModal, section, headerText, rstAnchor, filename) {
const urlPrefix = 'https://docs.typo3.org/permalink/';
const interlinkTarget = linkReferenceModal.dataset.interlinkShortcode || 'somemanual';
// Replaces a link like "typo3/cms-sys-note" to "typo3-cms-sys-note" (https://docs.typo3.org/permalink/typo3-cms-sys-note:for-editors)
const adjustedInterlinkTarget = interlinkTarget.replaceAll('/', '-', interlinkTarget);

if (rstAnchor) {
return urlPrefix + `${interlinkTarget}:${rstAnchor}`;
return urlPrefix + `${adjustedInterlinkTarget}:${rstAnchor}`;
}
if (filename === '') {
return '';
}

// Replaces a link like "typo3/cms-sys-note" to "typo3-cms-sys-note" (https://docs.typo3.org/permalink/typo3-cms-sys-note:for-editors)
const adjustedInterlinkTarget = interlinkTarget.replaceAll('/', '-', interlinkTarget);
// @todo - check how anchor hashes + filenames work with redirects? Other edge cases?
return urlPrefix + `${adjustedInterlinkTarget}:${filename}#${section?.id || ''}`;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/typo3-docs-theme/resources/public/js/theme.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c137f91

Please sign in to comment.