Getting the frontmatter in sveltekit __layout.svelte
See original GitHub issueI tried using an mdsvex layout and not using one, in both cases the default __layout.svelte
in the folder cannot access the frontmatter from the document.
Is there a way to pass it from the mdsvex layout (blog_layout.svelte
) to the default __layout.svelte
?
I’m kind of a beginner in svelte so I don’t know if there’s an easy svelte-level solution for this. I tried setContext()
from the mdsvex layout and getContext
in the default layout, but that didn’t work because __layout.svelte
runs first.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:20 (2 by maintainers)
Top Results From Across the Web
Frontmatter with MDSVEX
You can level up with Svelte Kit right now! Purchase individual course. $. 49 .99. Add To Cart. Become a Pro and unlock...
Read more >Advanced routing • Docs • SvelteKit
Like pages, layouts can themselves break out of their parent layout hierarchy, using the same technique. For example, a +layout@.svelte component would reset ......
Read more >I use vite-plugin-svelte-md, how can I get access to frontmatter ...
Hello, I setup vite-plugin-svelte-md with success in a SvelteKit project…
Read more >Using mdsvex with SvelteKit (Markdown + Svelte!) - YouTube
Markdown is nearly ubiqitous when it comes to blogging. Many applications use it for nicely editable files. With the mdsvex library, ...
Read more >Blogging in SvelteKit | CloudCannon
Getting set up in SvelteKit · Layouts in SvelteKit · SvelteKit Components ... which will be set through front matter in our post...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@zmre Is there any way to have mdsvex add this script tag to every page with front matter?
I expect you’re right about them needing to replace it with something that can serve a similar purpose if it goes away.
I think context only works within a group of components in the hierarchy and doesn’t work for flowing up to layouts.