Access env variables in frontmatter #3529
Replies: 2 comments
-
Not supported. You can use transformPageData hook to manually replace things. |
Beta Was this translation helpful? Give feedback.
-
What's your usage case? I personally use the cross-env npm package to define VITE_TARGET_PROJECT, which allows my VitePress scripts to run explicitly as per that variable. (in my project, a public facing project, and then the same project but privately facing) "docs-example_a:dev": "cross-env VITE_TARGET_PROJECT=example_a vitepress dev docs", I've been wondering how to properly employ node.js .env support for a vitepress project, without the use of the cross-env package. Although not necessarily for use in frontmatter, but rather just in index.js, posts.data.js, config.js and vue components. |
Beta Was this translation helpful? Give feedback.
-
Would like to know if it is possible to access .env variables inside the frontmatter section of .md files?
Beta Was this translation helpful? Give feedback.
All reactions