Using custom footer in all md files #7969
Replies: 1 comment
-
|
Docusaurus doesn’t have a built-in “global footer for only MD files” feature, but you can achieve this in a few clean ways depending on how strict and reusable you want it to be. Best approach (recommended): MDX wrapper componentInstead of pure 1. Create a shared footer component// src/components/DocsFooter.tsx
import React from 'react';
export default function DocsFooter() {
return (
<footer style={{ marginTop: '3rem', paddingTop: '2rem', borderTop: '1px solid #ddd' }}>
<p>Custom footer for documentation pages</p>
</footer>
);
}2. Create a layout wrapper// src/components/DocsLayout.tsx
import React from 'react';
import DocsFooter from './DocsFooter';
export default function DocsLayout({ children }) {
return (
<div>
{children}
<DocsFooter />
</div>
);
}3. Use it in
|
| Goal | Best solution |
|---|---|
| Few docs, high flexibility | MDX layout wrapper |
| Entire docs system footer | Swizzle DocItem/Layout |
| Large project, automation | Remark plugin |
Summary
Docusaurus renders Markdown through MDX internally, so the correct extension points are:
✔ Swizzle
DocItem/Layoutfor global behavior
✔ Or use MDX wrappers for per-page control
If this answer helped or pointed you in the right direction, I'd appreciate it if you could mark it as the accepted answer so it's easier for others with the same issue to find.
Also, if you found my contribution useful, I'd appreciate it if you could check out my GitHub profile, follow me, and star any repositories you find interesting.
GitHub: https://github.com/Advait251206
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am already using a custom footer for my landing page and all other js pages. But when it comes to md file , i want another common custom footer to add in all md files.
Is there a way to achieve this?
Beta Was this translation helpful? Give feedback.
All reactions