Fresh - Page title to Layout
Hi, I have been browsing around the docs and also being new to JSX,I'm not sure what I look for. What I want todo is have a variable in the title tag of my _layout. So I can pass that var via the page.
7 Replies
To set the document title from a route use the
<Head>
component. Example:
See https://fresh.deno.dev/docs/examples/modifying-the-headRight, I gave this as like recognizable example. I should have been more clear but it applies to non-head things
In that case, what do you mean with "title tag" instead?
This was a example. So it could also be a other part of the layout that expects per route values
Right, I'm admittedly having trouble understanding what you're trying to do. Maybe you can rephrase what you're looking for?
I have a section in my layout that depends on per route data. So like a head tag, I have a section within the layout that expects data from the Page (route). This is not a real example but Ill try to illustrate it.
Layout
Page:
So
title
and info_a
are defined within the page and should be rendered within the layout
Hopefully that explains what I'm trying todo
In "tradional" like tempalting engine it is often called blocks or sections and sometimes slotsIt looks like you're trying to dynamically populate certain elements in your layout based on route-specific data??. You might be able to achieve this using props