diff options
Diffstat (limited to 'index.html')
-rw-r--r-- | index.html | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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> |