bsc

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

sitemap.md (1143B)


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