Access app config in markdown content #1696
-
Hi, I'm creating a site using the document-driven mode, and I would like to access the app config data in the markdown. Currently I created a component (in <script setup lang="ts">
const config = useAppConfig();
</script>
<template>
<span>{{ config.title }}</span>
</template> **<site-title></site-title>** I saw that when I use the I would like to do something like this : {{ appConfig.title }} Is there any way to do this, without having to create individual components ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Just create one global component, and pass the key you want to display as a prop. So you can easily use that one component in your markdown files, to display any app config value. Another solution: in the |
Beta Was this translation helpful? Give feedback.
Just create one global component, and pass the key you want to display as a prop. So you can easily use that one component in your markdown files, to display any app config value.
Another solution: in the
content after parse
hook, add the keys you want to use in your markdown files as the autogenerated frontmatter. Then you can use the{{}}
syntax to display any such key.