Skip to content

Commit

Permalink
[example] use a +title.js function
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Oct 4, 2023
1 parent 05da941 commit 9a93058
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 1 addition & 5 deletions examples/basic/pages/star-wars/@id/+onBeforeRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ async function onBeforeRender(pageContext: PageContextBuiltInServer) {
// the client; we want to minimize what is sent over the network.
movie = filterMovieData(movie)

const { title } = movie

return {
pageContext: {
pageProps: {
movie
},
// The page's <title>
title
}
}
}
}
3 changes: 3 additions & 0 deletions examples/basic/pages/star-wars/@id/+title.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default (pageContext: any) => {
return pageContext.pageProps.movie.title
}

0 comments on commit 9a93058

Please sign in to comment.