commit 1277c4dc7b8dd7023ab7570f537a9cab671e898e
parent 46c77ef6b5d8cc1758ae908495d8f852d4e188e6
Author: Amit Dutta <mail@amit.is-a.dev>
Date: Wed, 12 Aug 2026 08:17:09 +0530
Merge pull request #36 from notamitgamer2/fix/raw-button-visibility
fix: hide raw/AI buttons on pages with no committed source
Diffstat:
21 files changed, 53 insertions(+), 6 deletions(-)
diff --git a/docs/.vitepress/theme/components/MarkdownMenu.vue b/docs/.vitepress/theme/components/MarkdownMenu.vue
@@ -1,5 +1,5 @@
<template>
- <ul class="md-links">
+ <ul v-if="frontmatter.source" class="md-links">
<li>
<a :href="rawUrl" target="_blank" rel="noopener">
<svg class="md-links-icon" viewBox="0 0 500 520" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -34,15 +34,17 @@
<script setup>
import { computed } from 'vue'
-import { useData, useRoute } from 'vitepress'
+import { useData } from 'vitepress'
const { frontmatter } = useData()
-const route = useRoute()
+// Only pages with an explicit `source:` frontmatter point at a file that is
+// actually committed to the repo — generated-but-uncommitted pages (e.g.
+// auto-built folder indexes) have no `source`, so the template hides this
+// menu entirely for them rather than falling back to a raw link that 404s.
const rawUrl = computed(() => {
const source = frontmatter.value.source
- const path = source || `docs${route.path.replace(/\/$/, '/index')}.md`
- return `https://raw.githubusercontent.com/notamitgamer/bsc/refs/heads/main/${path}`
+ return `https://raw.githubusercontent.com/notamitgamer/bsc/refs/heads/main/${source}`
})
const chatGptUrl = computed(() =>
diff --git a/docs/code_of_conduct.md b/docs/code_of_conduct.md
@@ -1,4 +1,5 @@
---
+source: 'docs/code_of_conduct.md'
title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="m11 17 2 2a1 1 0 1 0 3-3"/><path d="m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4"/><path d="m21 3 1 11h-2"/><path d="M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3"/><path d="M3 4h8"/></svg> Code of Conduct'
---
diff --git a/docs/contributing.md b/docs/contributing.md
@@ -1,4 +1,5 @@
---
+source: 'docs/contributing.md'
title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><path d="M16 3.128a4 4 0 0 1 0 7.744"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><circle cx="9" cy="7" r="4"/></svg> Contributing to bsc'
---
diff --git a/docs/credits.md b/docs/credits.md
@@ -1,4 +1,5 @@
---
+source: 'docs/credits.md'
title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M11 12h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 14"/><path d="m7 18 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9"/><path d="m2 13 6 6"/></svg> Acknowledgments'
---
diff --git a/docs/download.md b/docs/download.md
@@ -1,4 +1,5 @@
---
+source: 'docs/download.md'
title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/></svg> Downloads'
---
diff --git a/docs/faq.md b/docs/faq.md
@@ -1,4 +1,5 @@
---
+source: 'docs/faq.md'
title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M16 5H3"/><path d="M16 12H3"/><path d="M16 19H3"/><path d="M21 5h.01"/><path d="M21 12h.01"/><path d="M21 19h.01"/></svg> FAQ'
---
diff --git a/docs/index.md b/docs/index.md
@@ -1,4 +1,5 @@
---
+source: 'docs/index.md'
layout: home
hero:
diff --git a/docs/license.md b/docs/license.md
@@ -1,4 +1,5 @@
---
+source: 'docs/license.md'
title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M12 3v18"/><path d="m19 8 3 8a5 5 0 0 1-6 0zV7"/><path d="M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1"/><path d="m5 8 3 8a5 5 0 0 1-6 0zV7"/><path d="M7 21h10"/></svg> License'
---
diff --git a/docs/quickstart.md b/docs/quickstart.md
@@ -1,4 +1,5 @@
---
+source: 'docs/quickstart.md'
title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"/><path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09"/><path d="M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z"/><path d="M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05"/></svg> Quick Start'
---
diff --git a/docs/security.md b/docs/security.md
@@ -1,4 +1,5 @@
---
+source: 'docs/security.md'
title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/></svg> Security Policy'
---
diff --git a/docs/semester_1/index.md b/docs/semester_1/index.md
@@ -1,3 +1,7 @@
+---
+source: 'docs/semester_1/index.md'
+---
+
# Semester 1
::: info SEMESTER 1: ARCHIVED CONTENT
diff --git a/docs/semester_1/model_questions.md b/docs/semester_1/model_questions.md
@@ -1,4 +1,5 @@
---
+source: 'docs/semester_1/model_questions.md'
icon: lucide/file-badge
---
diff --git a/docs/semester_2/index.md b/docs/semester_2/index.md
@@ -1,3 +1,7 @@
+---
+source: 'docs/semester_2/index.md'
+---
+
# Semester 2
::: tip SEMESTER 2: ACTIVE CONTENT
@@ -68,4 +72,4 @@ Ensure you have Python 3 installed, or run the scripts via an IDE such as VS Cod
3. Execute the script using `python3`:
```bash
python3 Python_Prac-1.py
-```
+```+
\ No newline at end of file
diff --git a/docs/semester_3/index.md b/docs/semester_3/index.md
@@ -1,3 +1,7 @@
+---
+source: 'docs/semester_3/index.md'
+---
+
# Semester 3
::: warning Semester Pending
diff --git a/docs/semester_4/index.md b/docs/semester_4/index.md
@@ -1,3 +1,7 @@
+---
+source: 'docs/semester_4/index.md'
+---
+
# Semester 4
::: warning Semester Pending
diff --git a/docs/semester_5/index.md b/docs/semester_5/index.md
@@ -1,3 +1,7 @@
+---
+source: 'docs/semester_5/index.md'
+---
+
# Semester 5
::: warning Semester Pending
diff --git a/docs/semester_6/index.md b/docs/semester_6/index.md
@@ -1,3 +1,7 @@
+---
+source: 'docs/semester_6/index.md'
+---
+
# Semester 6
::: warning Semester Pending
diff --git a/docs/semester_7/index.md b/docs/semester_7/index.md
@@ -1,3 +1,7 @@
+---
+source: 'docs/semester_7/index.md'
+---
+
# Semester 7
::: warning Semester Pending
diff --git a/docs/semester_8/index.md b/docs/semester_8/index.md
@@ -1,3 +1,7 @@
+---
+source: 'docs/semester_8/index.md'
+---
+
# Semester 8
::: warning Semester Pending
diff --git a/docs/sitemap.md b/docs/sitemap.md
@@ -1,4 +1,5 @@
---
+source: 'docs/sitemap.md'
title: 'Sitemap'
description: 'All pages available on BSc Code Index.'
---
diff --git a/docs/terms.md b/docs/terms.md
@@ -1,4 +1,5 @@
---
+source: 'docs/terms.md'
title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></svg> Terms of Use'
---