summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
authorBlaster4385 <[email protected]>2024-04-21 19:20:06 +0530
committerBlaster4385 <[email protected]>2024-04-22 23:13:08 +0530
commitc81696200f75e3d3e842c4c781601ed06b5c35c1 (patch)
treea221a70a9ec556266a93bc683814a63ee78f88b5 /index.html
parent3623473f7755d906121ae90f28da7a2ef11ecf1b (diff)
feat: render all markdown files through a single page
Diffstat (limited to 'index.html')
-rw-r--r--index.html12
1 files changed, 11 insertions, 1 deletions
diff --git a/index.html b/index.html
index ca07552..b7d1822 100644
--- a/index.html
+++ b/index.html
@@ -44,7 +44,17 @@
<script src="markdown.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
- loadMarkdownFile('home.md');
+ // Get the pathname of the URL
+ const path = window.location.pathname;
+ // Remove leading slash if present
+ const trimmedPath = path.replace(/^\/|\/$/g, '');
+
+ if (trimmedPath === '') {
+ loadMarkdownFile('home.md');
+ return;
+ }
+ // Load the markdown file based on the path
+ loadMarkdownFile(`${trimmedPath}.md`);
});
</script>
</body>