-
Is there a way to suppress warnings when using mdx partial files |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
On building I see warnings like: [WARNING] Docusaurus MDX partial files should not contain front matter.
Those partial files use the _ prefix as a convention by default, but this is configurable.
File at /home/pat/personal/github/project/src/pages/team/_pdavid.mdx contains front matter that will be ignored:
{
"name": "Pat David",
"title": "Helper",
"social": {
"location": {
"label": "Employee, USA"
}
},
"photo": "patdavid.webp"
}
|
Beta Was this translation helpful? Give feedback.
-
We don't have an ability to disable that warning currently. It is here for a reason and prevent you from adding useless front-matter that Docusaurus won't consider. But I see how it could be annoying in some special cases. In v3.1 (or canary) we will ship a export default {
markdown: {
parseFrontMatter: async (params) => {
const result = await params.defaultParseFrontMatter(params);
if (isPartial(params.filePath)) {
result.frontMatter = {};
}
return result;
},
},
} The idea is that you can "erase" the front matter before docusaurus can even see it. |
Beta Was this translation helpful? Give feedback.
We don't have an ability to disable that warning currently.
It is here for a reason and prevent you from adding useless front-matter that Docusaurus won't consider. But I see how it could be annoying in some special cases.
In v3.1 (or canary) we will ship a
parseFrontMatter
generic feature that should solve the problem: #9624The idea is that you can "erase" the front matter before docusaurus can even see it.