feat: render all markdown files through a single page

This commit is contained in:
Blaster4385 2024-04-21 19:20:06 +05:30
parent 3623473f77
commit c81696200f
2 changed files with 11 additions and 53 deletions

View file

@ -44,7 +44,17 @@
<script src="markdown.js"></script> <script src="markdown.js"></script>
<script> <script>
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
// 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'); loadMarkdownFile('home.md');
return;
}
// Load the markdown file based on the path
loadMarkdownFile(`${trimmedPath}.md`);
}); });
</script> </script>
</body> </body>

View file

@ -1,52 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Meta tags for SEO -->
<meta name="description"
content="How TF do I ask a question?">
<meta name="keywords"
content="Venkatesh Chaturvedi, Blaster4385, tablaster, FOSS, CLI tools, Atlassian, Linux, Android, Open Source">
<meta name="author" content="Venkatesh Chaturvedi">
<meta name="robots" content="index, follow">
<!-- Open Graph meta tags for social sharing -->
<meta property="og:title" content="Question Guidelines">
<meta property="og:description"
content="How TF do I ask a question?">
<meta property="og:image" content="https://github.com/Blaster4385.png">
<meta property="og:url" content="https://tablaster.dev">
<meta property="og:type" content="website">
<!-- Twitter Card meta tags for social sharing -->
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@Blaster4385">
<meta name="twitter:title" content="Question Guidelines">
<meta name="twitter:description"
content="How TF do I ask a question?.">
<meta name="twitter:image" content="https://github.com/Blaster4385.png">
<title>Question Guidelines</title>
<link rel="icon" type="image/png" href="https://github.com/Blaster4385.png">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
</head>
<body>
<main class="container">
<header id="header">
<h1>$ tablaster.dev</h1>
</header>
<div id="markdown"></div>
</main>
<script src="markdown.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
loadMarkdownFile('question-guidelines.md');
});
</script>
</body>
</html>