-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
429b65d
commit 75fa58f
Showing
5 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fix using Vite env var names in Markdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/astro/test/fixtures/astro-markdown/src/pages/vite-env-vars.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: Referencing Vite Env Vars like import.meta.env.SITE and import.meta.env.TITLE | ||
layout: ../layouts/content.astro | ||
--- | ||
|
||
## Referencing the full name of Vite env vars | ||
|
||
You can get the configured site URL with `import.meta.env.SITE`. | ||
|
||
The variable `import.meta.env.TITLE` is not configured. | ||
|
||
This should also work outside of code blocks: | ||
- import.meta.env.SITE | ||
- import.meta.env.TITLE | ||
|
||
## Usage in fenced code blocks with syntax highlighting | ||
|
||
```js | ||
// src/pages/rss.xml.js | ||
import rss from '@astrojs/rss'; | ||
|
||
export const get = () => rss({ | ||
site: import.meta.env.SITE, | ||
title: import.meta.env.TITLE, | ||
items: import.meta.glob('./**/*.md'), | ||
}); | ||
``` | ||
|
||
## Usage in frontmatter | ||
|
||
> frontmatter.title: {frontmatter.title} |