bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / docs / sitemap.md

sitemap.md (1169B)


      1 ---
      2 source: 'docs/sitemap.md'
      3 title: 'Sitemap'
      4 description: 'All pages available on BSc Code Index.'
      5 ---
      6 
      7 # Sitemap
      8 
      9 <script setup>
     10 import { ref, onMounted } from 'vue'
     11 
     12 const pages = ref([])
     13 const loading = ref(true)
     14 const error = ref(false)
     15 
     16 function parseXml(text) {
     17   const parser = new DOMParser()
     18   const xml = parser.parseFromString(text, 'application/xml')
     19   return Array.from(xml.querySelectorAll('loc'))
     20     .map(loc => loc.textContent.replace('https://code.amit.is-a.dev', ''))
     21     .sort()
     22 }
     23 
     24 onMounted(async () => {
     25   try {
     26     const res = await fetch('/sitemap.xml')
     27     const text = await res.text()
     28     if (!res.ok || !text.includes('<loc>')) throw new Error('local not valid')
     29     pages.value = parseXml(text)
     30   } catch {
     31     try {
     32       const res = await fetch('https://code.amit.is-a.dev/sitemap.xml')
     33       pages.value = parseXml(await res.text())
     34     } catch {
     35       error.value = true
     36     }
     37   } finally {
     38     loading.value = false
     39   }
     40 })
     41 </script>
     42 
     43 <div v-if="loading">Loading sitemap...</div>
     44 <div v-else-if="error">Failed to load sitemap.</div>
     45 <ul v-else>
     46   <li v-for="page in pages" :key="page">
     47     <a :href="page">{{ page }}</a>
     48   </li>
     49 </ul>
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror