Skip to content

Commit d9d96cc

Browse files
do not redirect links to fork docs from main repo PRs - fork repo docs pages are often included in main repo PR descriptions as demonstration/verification
1 parent d981e24 commit d9d96cc

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

docs/templates/layout.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@
3939
/* We also want the inverse behavior for links that are hardcoded to the fork repo pages. */
4040
["softwareengineerprogrammer"].forEach((forkOrganizationName) => {
4141
["GEOPHIRES"].forEach((forkRepositoryName) => {
42-
if (locationHref.indexOf(`${forkOrganizationName}.github.io/${forkRepositoryName}`.toLowerCase()) !== -1
42+
if (
43+
locationHref.indexOf(`${forkOrganizationName}.github.io/${forkRepositoryName}`.toLowerCase()) !== -1
4344
&& (
4445
docReferrer.indexOf(`https://github.com/NatLabRockies/${forkRepositoryName}-X`.toLowerCase()) !== -1
4546
||
46-
document.referrer?.toLowerCase().indexOf(`https://github.com/NREL/${forkRepositoryName}-X`.toLowerCase()) !== -1)
47-
) {
47+
docReferrer.indexOf(`https://github.com/NREL/${forkRepositoryName}-X`.toLowerCase()) !== -1
48+
)
49+
&& docReferrer.indexOf('/pull/') === -1 // Links in main repo PR descriptions should not redirect
50+
) {
4851
console.debug('Redirecting to main repo docs based on referrer:', document.referrer);
4952
location.href = location?.href?.replace(
5053
`${forkOrganizationName}.github.io/${forkRepositoryName}`,

0 commit comments

Comments
 (0)