-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix not omitted extension in
url
metadata for newly added markdown …
…files in development (#5238) * test: add tests * test: add test case * test: update test * fix: add new extensions to regex used to removed * chore: add changeset * test: update test
- Loading branch information
1 parent
468aa3f
commit 26ff429
Showing
9 changed files
with
60 additions
and
6 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 not included file extension in `url` metadata for newly added markdown files |
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
16 changes: 16 additions & 0 deletions
16
packages/astro/test/fixtures/astro-global/src/pages/omit-markdown-extensions.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,16 @@ | ||
--- | ||
const markdownPosts = await Astro.glob('./post/**/*.{markdown,mdown,mkdn,mkd,mdwn,md}'); | ||
const markdownExtensions = /(\.(markdown|mdown|mkdn|mkd|mdwn|md))$/g | ||
const aUrlContainsExtension = markdownPosts.some((page:any)=> { | ||
return markdownExtensions.test(page.url) | ||
}) | ||
--- | ||
|
||
<html> | ||
<head> | ||
<title>Extensions omitted</title> | ||
</head> | ||
<body> | ||
<p data-any-url-contains-extension={JSON.stringify(aUrlContainsExtension)}>Placeholder</p> | ||
</body> | ||
</html> |
6 changes: 6 additions & 0 deletions
6
packages/astro/test/fixtures/astro-global/src/pages/post/post-4.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
title: 'Another post' | ||
layout: '../../layouts/post.astro' | ||
--- | ||
|
||
# Another post |
6 changes: 6 additions & 0 deletions
6
packages/astro/test/fixtures/astro-global/src/pages/post/post-5.mdown
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,6 @@ | ||
--- | ||
title: 'Another post' | ||
layout: '../../layouts/post.astro' | ||
--- | ||
|
||
# Another post |
6 changes: 6 additions & 0 deletions
6
packages/astro/test/fixtures/astro-global/src/pages/post/post-6.mkdn
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,6 @@ | ||
--- | ||
title: 'Another post' | ||
layout: '../../layouts/post.astro' | ||
--- | ||
|
||
# Another post |
6 changes: 6 additions & 0 deletions
6
packages/astro/test/fixtures/astro-global/src/pages/post/post-7.mkd
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,6 @@ | ||
--- | ||
title: 'Another post' | ||
layout: '../../layouts/post.astro' | ||
--- | ||
|
||
# Another post |
Empty file.