Skip to content

Commit

Permalink
Merge pull request #18678 from storybookjs/seo-page
Browse files Browse the repository at this point in the history
docs: Add SEO section to Publish docs page
  • Loading branch information
jonniebigodes authored and shilman committed Jul 26, 2022
1 parent d8f63c7 commit 97e7684
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
38 changes: 37 additions & 1 deletion docs/sharing/publish-storybook.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,40 @@ This level of service can serve published Storybooks but has no further integrat

Examples: [Netlify](https://www.netlify.com/), [S3](https://aws.amazon.com/en/s3/)

</details>
</details>

## Search engine optimization (SEO)

If your Storybook is publically viewable, you may wish to configure how it is represented in search engine result pages.

### Description

You can provide a description for search engines to display in the results listing, by adding the following to the `manager-head.html` file in your config directory:

<!-- prettier-ignore-start -->

<CodeSnippets
paths={[
'common/seo-description.html.mdx',
]}
/>

<!-- prettier-ignore-end -->

<div class="aside">
💡 You cannot also define <code>&lt;title></code> in this file, because Storybook generates the document title for you to include information about the currently-viewed component and story.
</div>

### Preventing your Storybook from being crawled

You can prevent your published Storybook from appearing in search engine results by including a noindex meta tag, which you can do by adding the following to the `manager-head.html` file in your config directory:

<!-- prettier-ignore-start -->

<CodeSnippets
paths={[
'common/seo-noindex.html.mdx',
]}
/>

<!-- prettier-ignore-end -->
5 changes: 5 additions & 0 deletions docs/snippets/common/seo-description.html.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```html
<!-- .storybook/manager-head.html -->

<meta name="description" content="Components for my awesome project" key="desc" />
```
5 changes: 5 additions & 0 deletions docs/snippets/common/seo-noindex.html.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```html
<!-- .storybook/manager-head.html -->

<meta name="robots" content="noindex" />
```

0 comments on commit 97e7684

Please sign in to comment.