unjs / unhead

Unhead is the any-framework document head manager built for performance and delightful developer experience.
https://unhead.unjs.io
MIT License
624 stars 41 forks source link

LiveBlogPosting #306

Closed djixadin closed 7 months ago

djixadin commented 9 months ago

Describe the feature

i looked through source code and the docs but i didnt found on how to use this particular schema. is it even implemented?

Additional information

harlan-zw commented 9 months ago

You can just use an Article and provide the additional type:

defineArticle({
  '@type': ['LiveBlogPosting'],
  ...
})

You can also use a custom node https://unhead.unjs.io/schema-org/recipes/custom-nodes

The scope of supported define<Node> composables is for Google Rich Results, however PRs are welcome

djixadin commented 9 months ago

I see. The problem is that live blog posting and coverage start time arent supported and therefore wont be added to schema org.. ill take a look about custom nodes and see what i can do

harlan-zw commented 9 months ago

I see. The problem is that live blog posting and coverage start time arent supported and therefore wont be added to schema org.. ill take a look about custom nodes and see what i can do

The nodes should support any arbitrary key, they just won't be typed

defineArticle({
  '@type': ['LiveBlogPosting'],
  coverageStartTime: '2022-10-20',
  ...
})
djixadin commented 9 months ago

i tried putting coverageStartTime like that and it doesn't appear in the html when inspecting. also i dont get types

image

using nuxt seo v2 rc4

harlan-zw commented 9 months ago

Working fine for me image

Can you provide a reproduction?

useSchemaOrg is not typed, only the define composables

djixadin commented 9 months ago

ill try to reproduce tomorrow..

image

djixadin commented 9 months ago

https://stackblitz.com/edit/nuxt-starter-u8ko1u?file=app.vue,nuxt.config.ts,.nuxt%2Ftypes%2Fimports.d.ts

in the .nuxt/types/imports.d.ts useSchemaOrg is of any or unknown and it links to this file node_modules/nuxt-schema-org/dist/runtime/nuxt/imports/useSchemaOrg.d.ts which has this code

import type { useSchemaOrg as _useSchemaOrg } from '@unhead/schema-org/vue';
type Input = Parameters<typeof _useSchemaOrg>[0];
export declare function useSchemaOrg(input: Input): any;
export {};