-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: export custom Title component from MDX (#420)
* feat: export custom title components from MDX * Update packages/example/src/pages/components/MDX.mdx Co-Authored-By: emyarod <emyarod@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
61 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: MDX | ||
description: guide for working with MDX and gatsby-theme-carbon | ||
--- | ||
|
||
export const Title = () => ( | ||
<span> | ||
First line <br /> Second line | ||
</span> | ||
); | ||
|
||
<PageDescription> | ||
|
||
MDX allows for certain things beyond what markdown is capable of. Content here | ||
will discuss using those features to augment or modify the default content | ||
layout. | ||
|
||
</PageDescription> | ||
|
||
<AnchorLinks> | ||
<AnchorLink>Frontmatter</AnchorLink> | ||
<AnchorLink>Custom title</AnchorLink> | ||
</AnchorLinks> | ||
|
||
## Frontmatter | ||
|
||
You can declare frontmatter in your `.mdx` files to provide specific metadata for the theme to use. | ||
The most important of which is the `title`. You can also provide a description and keywords which will be added to the `head` of your document. | ||
|
||
```md | ||
--- | ||
title: Markdown | ||
description: Usage instructions for the Markdown component | ||
keywords: 'ibm,carbon,gatsby,mdx,markdown' | ||
--- | ||
``` | ||
|
||
## Custom title | ||
|
||
You can export a `Title` component in order to render a unique title for a single page. This is particularly useful for including line breaks at a specific location. | ||
|
||
**Note:** You still need to provide a regular string title to the frontmatter for search, navigation, and the HTML header title to work. | ||
|
||
```jsx | ||
--- | ||
title: MDX | ||
description: custom title page | ||
--- | ||
|
||
export const Title = () => ( | ||
<span> | ||
First line <br /> Second line | ||
</span> | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7438608
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully aliased the URL https://gatsby-theme-carbon-960eifmc6.now.sh to the following aliases: