fix: correctly handle local links
This commit is contained in:
parent
ddb00cadfb
commit
28242c5519
3 changed files with 5 additions and 2 deletions
|
@ -4,7 +4,7 @@ Hey folks, I'm Venkatesh Chaturvedi, currently working as an Associate Support E
|
||||||
|
|
||||||
## $ ls blogs/
|
## $ ls blogs/
|
||||||
|
|
||||||
- **[git-101](https://tablaster.dev/git-101)**
|
- **[git-101](/git-101)**
|
||||||
|
|
||||||
## $ ls projects/
|
## $ ls projects/
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<body>
|
<body>
|
||||||
<main class="container">
|
<main class="container">
|
||||||
<header id="header">
|
<header id="header">
|
||||||
<h1>$ tablaster.dev</h1>
|
<h1><a href="/">$ tablaster.dev</a></h1>
|
||||||
</header>
|
</header>
|
||||||
<div id="markdown"></div>
|
<div id="markdown"></div>
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -17,6 +17,9 @@ function convertMarkdownToHTML(markdown) {
|
||||||
function addBlankTargetToLinks() {
|
function addBlankTargetToLinks() {
|
||||||
const links = document.querySelectorAll('a');
|
const links = document.querySelectorAll('a');
|
||||||
links.forEach(link => {
|
links.forEach(link => {
|
||||||
|
if (!link.getAttribute('href').startsWith('http') && !link.getAttribute('href').startsWith('https')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
link.setAttribute('target', '_blank');
|
link.setAttribute('target', '_blank');
|
||||||
});
|
});
|
||||||
}
|
}
|
Loading…
Reference in a new issue