Skip to content

Commit

Permalink
feat: support identity site config
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Sep 9, 2023
1 parent a403fef commit 5a90e83
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions module/src/runtime/plugin/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,25 @@ export default defineNuxtPlugin({
}),
defineWebPage(),
])
if (siteConfig.identity) {
const identityPayload: Person | Organization = {
name: siteConfig.identity.name || siteConfig.name,
url: siteConfig.url,
}
if (siteConfig.twitter) {
// without the @
const id = siteConfig.twitter.startsWith('@')
? siteConfig.twitter.slice(1)
: siteConfig.twitter
identityPayload.sameAs = [
`https://twitter.com/${id}`,
]
}
useSchemaOrg([
siteConfig.identity.type === 'Person'
? definePerson(identityPayload)
: defineOrganization(identityPayload),
])
}
},
})

0 comments on commit 5a90e83

Please sign in to comment.