Can I render a different md file based on query string param? #4281
-
My use can is that I am trying to convert an existing website that uses query strings to render different versions of the documentation. So, for example, https://docs.particular.net/nservicebus/licensing/?version=core_7 a version but https://docs.particular.net/nservicebus/licensing/?version=core_9 renders a different version. I want the sidebar item to stay active. This is different from regular versioning of a single product, because this website contains many different"products", so we allow versioning at the page level. I hope this makes sense, let me know. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
You can use vue inside markdown, so something like this is possible: <template v-if="version === 'core_7'>
# license for core_7
</template>
<template v-if="version === 'core_9'>
# license for core_9
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue'
const version = ref('')
onMounted(() => {
version.value = (new URLSearchParams(window.location.search)).get('version')
})
</script> If you think the file is getting big, you can move the markdown parts to different files and include or import them. |
Beta Was this translation helpful? Give feedback.
You can use vue inside markdown, so something like this is possible:
If you think the file is getting big, you can move the markdown parts to different files and include or import them.