-
-
Save brillout/e7fe603bd44c9ec1be7e98f3ae28636a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /pages/+title.js | |
// Environment: server, client | |
// This title function applies to all our pages /pages/**/+page.js | |
export { title } | |
import { useData } from 'vike/react' // or 'vike-vue' / 'vike-solid' | |
// If a page fetches data and data.title is defined, then use it to set the page's title (i.e the value of <title>). | |
function title() { | |
const data = useData() | |
return data?.title || 'SpaceX' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment