Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding multiple documentation. #2870

Open
aydinvivik opened this issue May 6, 2024 · 2 comments
Open

Adding multiple documentation. #2870

aydinvivik opened this issue May 6, 2024 · 2 comments

Comments

@aydinvivik
Copy link

aydinvivik commented May 6, 2024

Hello, I have a scenario with multiple documentation and some articles are in more than one documentation. Instead of rewriting the same article for each documentation, can I create one globally and show it in the article I want?

pages
  -documentation-1
      _meta.json
      index.mdx
      started.mdx (Global)
      credits.mdx (Global)
  -documentation-2
      _meta.json
      index.mdx
      started.mdx (Global)
      credits.mdx (Global)
  -documentation-3
      _meta.json
      index.mdx
  _meta.json
  index.mdx
  started.mdx (Global)
  credits.mdx (Global)
@Fun117
Copy link

Fun117 commented May 9, 2024

Hello, aydinvivik,

Although I'm not the developer of this service, I'd be happy to assist you as much as I can.

As you rightly pointed out, it can be cumbersome to write the same article repeatedly across different documents. In such cases, exporting and importing Markdown files can be quite helpful.

For example, you can write the common content in a file named task-list.mdx and then import it into other MDX pages. Specifically, the content of task-list.mdx could look like this:

- [x] Code
- [x] Sleep
- [ ] Eat

To import this file into another page (for example, index.mdx), you would write the following:

import TaskList from './task-list.mdx'
 
<TaskList />

By doing this, the content defined in task-list.mdx will be displayed in other pages.

If you have any questions, please feel free to ask. I'd be happy to help if I can.

Docs: https://the-guild.dev/blog/nextra-2#markdown-import

@aydinvivik
Copy link
Author

@Fun117 Thank you very much for your feedback, I will try this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants