Skip to content

Commit 63587e6

Browse files
committed
Update link.js
1 parent 1cbfbe2 commit 63587e6

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

api/link.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,24 @@ export default function handler(request, response) {
3232

3333
} else {
3434

35-
title = repoName + ' on Codeit';
35+
let parsedDir = url.split('/');
36+
37+
parsedDir[1] = repo.split(':')[0];
38+
39+
if (query.url.startsWith('https://github.com') ||
40+
query.url.startsWith('https:/github.com')) {
41+
42+
if (parsedDir[2] === 'blob') {
43+
44+
parsedDir.splice(2, 2);
45+
46+
}
47+
48+
}
49+
50+
parsedDir = parsedDir.join('/');
51+
52+
title = parsedDir + ' on Codeit';
3653

3754
}
3855

0 commit comments

Comments
 (0)