diff --git a/examples/with-markdoc/markdoc.config.mjs b/examples/with-markdoc/markdoc.config.mjs
index 0ae63d4ee..3a40e0043 100644
--- a/examples/with-markdoc/markdoc.config.mjs
+++ b/examples/with-markdoc/markdoc.config.mjs
@@ -1,14 +1,10 @@
import { defineMarkdocConfig } from '@astrojs/markdoc/config';
-import Aside from './src/components/Aside.astro';
+import Ben from './src/components/Ben.astro';
export default defineMarkdocConfig({
tags: {
- aside: {
- render: Aside,
- attributes: {
- type: { type: String },
- title: { type: String },
- },
+ ben: {
+ render: Ben,
},
},
});
diff --git a/examples/with-markdoc/src/components/Ben.astro b/examples/with-markdoc/src/components/Ben.astro
new file mode 100644
index 000000000..826d5c187
--- /dev/null
+++ b/examples/with-markdoc/src/components/Ben.astro
@@ -0,0 +1,6 @@
+---
+import { getEntry } from 'astro:content';
+const author = await getEntry('docs', 'ben');
+---
+
+
{author?.data.name}
diff --git a/examples/with-markdoc/src/content/authors/ben copy.json b/examples/with-markdoc/src/content/authors/ben copy.json
new file mode 100644
index 000000000..4521befc7
--- /dev/null
+++ b/examples/with-markdoc/src/content/authors/ben copy.json
@@ -0,0 +1,3 @@
+{
+ "name": "Ben"
+}
diff --git a/examples/with-markdoc/src/content/authors/ben.json b/examples/with-markdoc/src/content/authors/ben.json
new file mode 100644
index 000000000..4521befc7
--- /dev/null
+++ b/examples/with-markdoc/src/content/authors/ben.json
@@ -0,0 +1,3 @@
+{
+ "name": "Ben"
+}
diff --git a/examples/with-markdoc/src/content/docs/ben.mdoc b/examples/with-markdoc/src/content/docs/ben.mdoc
new file mode 100644
index 000000000..61b37e65a
--- /dev/null
+++ b/examples/with-markdoc/src/content/docs/ben.mdoc
@@ -0,0 +1,3 @@
+---
+name: Ben 👋
+---
diff --git a/examples/with-markdoc/src/content/docs/intro.mdoc b/examples/with-markdoc/src/content/docs/intro.mdoc
index c8fcf5675..46db4282d 100644
--- a/examples/with-markdoc/src/content/docs/intro.mdoc
+++ b/examples/with-markdoc/src/content/docs/intro.mdoc
@@ -2,38 +2,4 @@
title: Welcome to Markdoc 👋
---
-This simple starter showcases Markdoc with Content Collections. All Markdoc features are supported, including this nifty built-in `{% table %}` tag:
-
-{% table %}
-* Feature
-* Supported
----
-* `.mdoc` in Content Collections
-* ✅
----
-* Markdoc transform configuration
-* ✅
----
-* Astro components
-* ✅
-{% /table %}
-
-{% aside title="Code Challenge" type="tip" %}
-
-Reveal the secret message below by adding `revealSecret` to your list of Markdoc variables.
-
-_Hint: Try passing as a prop to the `` component in the `src/pages/index.astro` file._
-
-{% if $revealSecret %}
-
-Maybe the real secret was the Rick Rolls we shared along the way.
-
-![Rick Astley dancing](https://media.tenor.com/x8v1oNUOmg4AAAAM/rickroll-roll.gif)
-
-{% /if %}
-
-{% /aside %}
-
-Check out [the `@astrojs/markdoc` integration][astro-markdoc] for complete documentation and usage examples.
-
-[astro-markdoc]: https://docs.astro.build/en/guides/integrations-guide/markdoc/
+{% ben /%}
diff --git a/examples/with-markdoc/src/pages/index.astro b/examples/with-markdoc/src/pages/index.astro
index d7b41e50f..04cef4cad 100644
--- a/examples/with-markdoc/src/pages/index.astro
+++ b/examples/with-markdoc/src/pages/index.astro
@@ -1,8 +1,8 @@
---
-import { getEntryBySlug } from 'astro:content';
+import { getEntry } from 'astro:content';
import Layout from '../layouts/Layout.astro';
-const intro = await getEntryBySlug('docs', 'intro');
+const intro = await getEntry('docs', 'intro');
const { Content } = await intro.render();
---
diff --git a/packages/astro/content-module.template.mjs b/packages/astro/content-module.template.mjs
index e0ac7a564..69f4f0410 100644
--- a/packages/astro/content-module.template.mjs
+++ b/packages/astro/content-module.template.mjs
@@ -41,13 +41,17 @@ function createGlobLookup(glob) {
const filePath = lookupMap[collection]?.entries[lookupId];
if (!filePath) return undefined;
- return glob[collection][filePath];
+ const res = glob[collection][filePath];
+ console.log('res', res);
+ return res;
};
}
-const renderEntryGlob = import.meta.glob('@@RENDER_ENTRY_GLOB_PATH@@', {
- query: { astroRenderContent: true },
-});
+const renderEntryGlob = {
+ '/src/content/docs/intro.mdoc': () => import('/src/content/docs/intro.mdoc'),
+ '/src/content/docs/ben.mdoc': () => import('/src/content/docs/ben.mdoc'),
+};
+console.log('glob', renderEntryGlob);
const collectionToRenderEntryMap = createCollectionToGlobResultMap({
globResult: renderEntryGlob,
contentDir,
diff --git a/packages/astro/src/content/runtime.ts b/packages/astro/src/content/runtime.ts
index 84e3162bf..a923f0c97 100644
--- a/packages/astro/src/content/runtime.ts
+++ b/packages/astro/src/content/runtime.ts
@@ -268,6 +268,7 @@ async function render({
if (typeof renderEntryImport !== 'function') throw UnexpectedRenderError;
const baseMod = await renderEntryImport();
+ console.log('baseMod', baseMod);
if (baseMod == null || typeof baseMod !== 'object') throw UnexpectedRenderError;
const { default: defaultMod } = baseMod;
diff --git a/packages/astro/src/core/render/dev/vite.ts b/packages/astro/src/core/render/dev/vite.ts
index fe4d3f791..fae2ab084 100644
--- a/packages/astro/src/core/render/dev/vite.ts
+++ b/packages/astro/src/core/render/dev/vite.ts
@@ -14,6 +14,8 @@ const fileExtensionsToSSR = new Set(['.astro', '.mdoc', ...SUPPORTED_MARKDOWN_FI
const STRIP_QUERY_PARAMS_REGEX = /\?.*$/;
const ASTRO_PROPAGATED_ASSET_REGEX = /\?astroPropagatedAssets/;
+const mwho = new Set();
+
/** recursively crawl the module graph to get all style files imported by parent id */
export async function* crawlGraph(
loader: ModuleLoader,
@@ -70,9 +72,14 @@ export async function* crawlGraph(
if (
isFileTypeNeedingSSR &&
// Should not SSR a module with ?astroPropagatedAssets
- !isPropagationStoppingPoint
+ !isPropagationStoppingPoint &&
+ !mwho.has(importedModule.id)
) {
const mod = loader.getModuleById(importedModule.id);
+ if (importedModule.id.includes('.mdoc')) {
+ console.log('mdoc', importedModule.id);
+ mwho.add(importedModule.id);
+ }
if (!mod?.ssrModule) {
try {
await loader.import(importedModule.id);