-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
18 additions
and
16 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
import { PageContext } from 'vike/types' | ||
|
||
import { META } from '#src/env' | ||
import i18n from '#plugins/i18n' | ||
|
||
function getTitle(pageContext: PageContext) { | ||
// The value exported by /pages/**/+title.js is available at pageContext.config.title | ||
const val = pageContext.config.title | ||
if (typeof val === 'string') return val | ||
if (typeof val === 'function') return String(val(pageContext)) | ||
return META.DEFAULT_TITLE | ||
return i18n.global.t('meta.defaultTitle') | ||
} | ||
|
||
function getDescription(pageContext: PageContext) { | ||
const val = pageContext.config.description | ||
if (typeof val === 'string') return val | ||
if (typeof val === 'function') return val(pageContext) | ||
return META.DEFAULT_DESCRIPTION | ||
return i18n.global.t('meta.defaultDescription') | ||
} | ||
|
||
export { getTitle, getDescription } |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { META } from '#src/env' | ||
import i18n from '#plugins/i18n' | ||
|
||
export const title = META.DEFAULT_TITLE | ||
export const title = () => i18n.global.t('meta.defaultTitle') |
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