"Breadcrumbs" and accessing parent pageContext and config #3104
Unanswered
davenquinn
asked this question in
Help & Questions
Replies: 1 comment
-
|
See https://vike.dev/markdown#metadata — the bottom line is that it's important to realize that the implementation depends on whether you want the page metadata to be available to all pages (global) or only to the page (local).
I ain't sure what you mean. In principle, with I updated the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I have been trying to solve a problem that I feel is likely achievable using the current capabilities of Vike, but I am not quite sure of the right way to go about it, or how it fits with the current
+configmodel and override approach.The need is essentially for a list of "breadcrumbs" that can be consumed by the page layouts that map onto the filesystem routing. Basically, each page context needs access to a list of values that collectively represent path items that are "above" the current page, e.g.,
I can already do the basic version of this by processing the
routeParamsobject and either inferring the name from the page slug or merging with a globally maintained sitemap that maps paths to names.My question arises if I want to use a configuration value for each page to locally define how that page's entry should be named. I can almost do this by creating a new cumulative
+pageNameconfiguration (avoiding+titlebecause that is already set as non-cumulative byvike-react). However, in order to have a 1:1 relationship with path name, that value would have to be evaluated at every page. If I define+pageNameat the root level as some function, likeI only get one entry in the cumulative
pageNameconfig representing this function evaluated for the current page context.Is there a recommended way to get a config value evaluated at each level of the nested route hierarchy, beyond defining the config value explicitly at every level? Would be curious to hear how others would/have solved this.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions