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

feat(v2): useDocusaurusContext().siteMetadata #3058

Merged
merged 1 commit into from
Jul 16, 2020

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Jul 14, 2020

Motivation

Expose siteMetadata in useDocusaurusContext() hook

Algolia devs need access docusaurus version, and we should rather advise to use the hook instead of importing a static generated file (makes comp testing easier by using a provider)

See also:


@SamChou19815 I moved a bit the type declaration to match what we currently have for siteConfig type declaration and be uniform.

Not totally sure yet what's the impact of declaring types in one or the other of @docusaurus/types vs docusaurus-module-type-aliases

@slorber slorber requested a review from yangshun as a code owner July 14, 2020 13:36
@slorber slorber added the pr: new feature This PR adds a new API or behavior. label Jul 14, 2020
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jul 14, 2020
isClient?: boolean;
siteConfig: DocusaurusConfig;
siteMetadata: DocusaurusSiteMetadata;
isClient: boolean;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the ? here, we shouldn't use the hook and retrieve a partial context, we should fail fast instead.

@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit b05bc79

https://deploy-preview-3058--docusaurus-2.netlify.app

@slorber slorber merged commit 1272ab8 into master Jul 16, 2020
@yangshun yangshun deleted the slorber/expose-site-metadata branch July 26, 2020 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants