releases

v1 Release

Release v1 is here, learn what new features are available and how to migrate.

Background

After releasing 0.x it was clear that the package was missing some functionality:

  • No schema.dts support
  • Package added ~30kb to your page weight
  • Reactivity was dodgy

After a few weeks rebuilding the core and struggling with the module resolutions, I've managed to solve all of the above.

Breaking changes were attempted to be minimised but have been implemented where needed to simplify the API.

๐Ÿš€ Features

๐ŸŒฒ Performance Improvements

The package now supports mocking out runtime define functions and components for client-side builds.

  • Ships 0kb of JS to the client - ~30kb reduction! This is enabled by default for environments using SSR. See the client User Config for more details.
  • Script is embedded to the end of the body to avoid slowing down DOM render

๐Ÿ‡น Simple and Full Types

Types for define functions are now runtime, supporting switching the types being used.

  • Supports schema-dts You can opt-in to "full" mode which augments the types to use schema-dts. See the full User Config for more details.
  • Reactivity Type Types for fields are now all MaybeRefable.
  • Automatic Aliasing When switching between full and simple modes your tsconfig.json wil be updated for you.

๐Ÿ’ช New Core

The core was rebuilt and is now available as its own package: @unhead/schema-org.

  • Improved reactivity
  • Less performance overhead in resolving graph
  • Runtime overrides of user config
  • New Schema.org: Course, Event, Book, SoftwareApp
  • Better resolving of relationships requiring less boilerplate

Others

  • Webpack support
  • New Docs powered by Docus

Migration Guide

As a first step, you should follow the new installation docs for your framework again and verify integration is up-to-date:

High Risk - Breaking Changes

Partial define functions removed

To allow for empty define functions while providing a strict API, the define${Node}Partial functions existed. This has been removed to simplify the API.

You will need to remove any define partial functions in favour of the main define functions.

Before - v0
defineWebPagePartial({
  // ...
})

Component prop render-scoped-slots removed

Previously you were able to provide the render-scoped-slots prop to allow scoped slots to render. This was useful to minimise code, but was removed as the functionality was misleading.

You will now need to render within the default slot.

Before - v0
<template>
  <SchemaOrgQuestion render-scoped-slots>
    <template #question>
      What is the question?
    </template>
    <template #answer>
      Not sure
    </template>
  </SchemaOrgQuestion>
</template>

SchemaOrgInspector renamed to SchemaOrgDebug

Before - v0
<template>
  <SchemaOrgInspector />
</template>

SearchAction and ReadAction composables renamed

Before - v0
defineWebSite({
  potentialAction: [
    asSearchAction({
      target: '/search?q={search_term_string}'
    })
  ]
})

Next Steps

Once you have finished migrating, it's worth re-testing your Schema.org using https://validator.schema.org/ and https://search.google.com/test/rich-results.

If you see any issues please create an issue.