我在 MDX 文件中有两个场合,我想使用根相对路径而不是相对路径。MDX 页面嵌套很深。所以我最终在许多../../..
文件夹示例是:
/content/products/
/content/products/brands/some-brand/index.mdx
/content/products/brands/some-brand/some-feature/first-product.mdx
/content/images/brand-images/some-brand.png
/content/images/brand-images/other-brand.png
/src/components/products/
前物质图像路径
我按照这个例子。
---
title: Some title
brand-image: ../../../images/brand-images/some-brand.png
---
成分
import Products from '../../../../src/components/products';
这样的事情可能吗?
---
title: Some title
brand-image: ${PROJECT_ROOT}/content/images/brand-images/some-brand.png
---
import Products from '${PROJECT_ROOT}/src/components/products';
Hi, I'm a page with many products. It's just to show, how I use the MDX pages.
<Products pkey="some-brand" tags={/.*Corp.*Gov.*/}/>