Inconsistent naming of `BlogLayout`/`BlogPostLayout`
Closed this issue · 4 comments
ajcwebdev commented
Part way through the tutorial we switch from BlogLayout
to BlogPostLayout
in the router.
Layouts
We'll wrap
HomePage
andAboutPage
with theBlogLayout
, using a<Set>
:
import { Router, Route, Set } from '@redwoodjs/router'
import BlogLayout from 'src/layouts/BlogLayout'
const Routes = () => {
return (
<Router>
<Set wrap={BlogLayout}>
<Route path="/about" page={AboutPage} name="about" />
<Route path="/" page={HomePage} name="home" />
</Set>
<Route notfound page={NotFoundPage} />
</Router>
)
}
export default Routes
Routing Params
Code sample says one while the text explanation says the other:
And while we're in the routes file, lets move the route inside the
Set
with theBlogPostLayout
.
<Router>
<Set wrap={BlogLayout}>
<Route path="/blog-post/{id}" page={BlogPostPage} name="blogPost" />
<Route path="/about" page={AboutPage} name="about" />
<Route path="/" page={HomePage} name="home" />
</Set>
<Route notfound page={NotFoundPage} />
</Router>
Web Authentication
import { Router, Route, Set, Private } from '@redwoodjs/router'
import BlogPostLayout from 'src/layouts/BlogPostLayout'
const Routes = () => {
return (
<Router>
<Set wrap={BlogPostLayout}>
<Route path="/blog-post/{id:Int}" page={BlogPostPage} name="blogPost" />
<Route path="/contact" page={ContactPage} name="contact" />
<Route path="/about" page={AboutPage} name="about" />
<Route path="/" page={HomePage} name="home" />
</Set>
<Private unauthenticated="home">
<Route path="/admin/posts/new" page={NewPostPage} name="newPost" />
<Route path="/admin/posts/{id:Int}/edit" page={EditPostPage} name="editPost" />
<Route path="/admin/posts/{id:Int}" page={PostPage} name="post" />
<Route path="/admin/posts" page={PostsPage} name="posts" />
</Private>
<Route notfound page={NotFoundPage} />
</Router>
)
}
export default Routes
cannikin commented
Yeah should be BlogLayout
, that other one may have snuck in when it got updated with the <Set>
.
I like BlogLayout
because it’s the layout for the whole blog, not just a single blog post.
clairefro commented
I'll make a quickie PR