Skip to content
Discussion options

You must be logged in to vote

However, rather than doing this for each component, is it possible to do this at the root?

The root /layout doesn't currently have access frontmatter. Not all pages are Markdown documents with available frontMatter.

You can try to swizzle MDXContent and use useFrontMatter (from https://github.com/roydukkey/docusaurus-theme-frontmatter, but we'll likely add something like this in core later)

I am trying to implement route protection, where some documents are public, and other documents are limited to specific users.
Then, I am wrapping each component that would render documents, to check if that user is logged in.

Not sure what your "wrapper protection" is exactly, but keep in mind tha…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lukedukeus
Comment options

Answer selected by lukedukeus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants