Using dynamic titles in +Head #1732
-
I have an app with this structure:
I use both the static and dynamic title formats. So: // /pages/index/+title.ts
export default "A static title!";
// /pages/blog/+title.ts
export default ctx => "A dynamic title!"; I want to generate social media tags based on the title. So I've been doing: // /pages/+Head.tsx
import { usePageContext } from "vike-react/usePageContext";
export let Head = () => {
let pageContext = usePageContext();
let title = pageContext.config.title; // ?????
return <meta property="og:title" content={title} />
} However, even though Vike claims that
Is it one of those two cases? Or am I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
It works as intended: For your use case, you have to resolve the function yourself. I think the best would be that |
Beta Was this translation helpful? Give feedback.
Done (vikejs/vike-react@024b6ad) and pre-released as
0.4.17-commit-024b6ad
.