-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add missing props in markdown layout (#3588)
The `url` props was missing but should there according to [this document](https://docs.astro.build/en/guides/markdown-content/#markdown-layouts). The `file` props was not initially there but is quite useful when you need to resolve file which are relative to the markdown file itself.
- Loading branch information
1 parent
39c8647
commit 5d0edfc
Showing
5 changed files
with
38 additions
and
1 deletion.
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 missing props (url, file) in markdown layout |
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
17 changes: 17 additions & 0 deletions
17
packages/astro/test/fixtures/astro-markdown/src/layouts/layout-props.astro
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,17 @@ | ||
--- | ||
interface Props { | ||
url: string; | ||
file: string; | ||
title: string; | ||
} | ||
const { title, url, file } = Astro.props.content as Props; | ||
--- | ||
|
||
<html> | ||
<body> | ||
<div id="title">{title}</div> | ||
<div id="url">{url}</div> | ||
<div id="file">{file}</div> | ||
</body> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
packages/astro/test/fixtures/astro-markdown/src/pages/layout-props.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,4 @@ | ||
--- | ||
title: 'Hello world!' | ||
layout: '../layouts/layout-props.astro' | ||
--- |