Skip to content

Is there any way to get Docs theme front-matter's image? like using hooks? #10790

Answered by slorber
effozen asked this question in Q&A
Discussion options

You must be logged in to vote

Unfortunately it's not possible, the props theme components receive are quite "static" and there's no easy way to add more data to those apart forking/enhancing our existing plugins.

In the future, React Server Components should give you the flexibility to achieve your needs
#9089

In DocCategoryGeneratedIndexPage, the DocCard components receive the same data structure as sidebar items (because this page displays a list of sidebar items at a given level). If you pass sidebar_custom_props as front matter to your docs, then DocCard should receive that as props (and you can eventually "automate" that by rewriting image to sidebar_custom_props.image thanks to parseFrontMatter)

Replies: 1 comment 1 reply

Comment options

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

Answer selected by effozen
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