-
|
Hey all What is the best way to have the same site only once but have some "conditions" for some paragraphs? Like in Jekyll: {% if param == "old-page" -%}
do not do that
{% elsif param == "new-page" -%}
do this
{% endif -%}What would have to be done? Note that the pages (docs, Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
|
We don't have a built-in way to do that, but you can plug this logic yourself. You can create a custom remark plugin that will remove the unwanted paragraphs based on plugin options and some syntax: Our admonition plugin can be useful for inspiration: https://github.com/elviswolcott/remark-admonitions You can create a React component and use it in MD (thanks to MDX). # My title
Some text
<MyComp
oldContent={
<>
Some **markdown text**
</>
}
newContent={
<>
Some **markdown text**
</>
}
/>I wouldn't recommend this for long texts because both text strings will be in your final JS bundle for that page and make it heavier. We could make the site config available in md docs so that you can do: This is basically similar to the 2nd solution, just a shortcut not requiring an intermediate component. |
Beta Was this translation helpful? Give feedback.
We don't have a built-in way to do that, but you can plug this logic yourself.
You can create a custom remark plugin that will remove the unwanted paragraphs based on plugin options and some syntax:
Our admonition plugin can be useful for inspiration: https://github.com/elviswolcott/remark-admonitions
You can create a React component and use it in MD (thanks to MDX).
The component will display one text or another according to config it reads through
useDocusaurusContext