diff options
author | Blaster4385 <blaster4385@tablaster.dev> | 2024-04-22 00:53:41 +0530 |
---|---|---|
committer | Blaster4385 <blaster4385@tablaster.dev> | 2024-04-22 23:13:08 +0530 |
commit | 57f50462a54920d8a87aaefa1e6945338270ebe5 (patch) | |
tree | 36a988b924284845aad4db769afd685a62d6dd54 | |
parent | 9260dc0239d9e9c81c8ed104523f035bd5fd10a0 (diff) |
fix: correctly handle local links
-rw-r--r-- | assets/md/home.md | 2 | ||||
-rw-r--r-- | index.html | 2 | ||||
-rw-r--r-- | markdown.js | 3 |
3 files changed, 5 insertions, 2 deletions
diff --git a/assets/md/home.md b/assets/md/home.md index 6047751..f170045 100644 --- a/assets/md/home.md +++ b/assets/md/home.md @@ -4,7 +4,7 @@ Hey folks, I'm Venkatesh Chaturvedi, currently working as an Associate Support E ## $ ls blogs/ -- **[git-101](https://tablaster.dev/git-101)** +- **[git-101](/git-101)** ## $ ls projects/ @@ -36,7 +36,7 @@ <body> <main class="container"> <header id="header"> - <h1>$ tablaster.dev</h1> + <h1><a href="/">$ tablaster.dev</a></h1> </header> <div id="markdown"></div> </main> diff --git a/markdown.js b/markdown.js index 3dac757..4b9521f 100644 --- a/markdown.js +++ b/markdown.js @@ -17,6 +17,9 @@ function convertMarkdownToHTML(markdown) { function addBlankTargetToLinks() { const links = document.querySelectorAll('a'); links.forEach(link => { + if (!link.getAttribute('href').startsWith('http') && !link.getAttribute('href').startsWith('https')) { + return; + } link.setAttribute('target', '_blank'); }); }
\ No newline at end of file |