Schema.org Adapter
    Preparing search index...

    Function fetchSchemaVersions

    • Returns the schema.org version file, which is fetched once and then saved in local cache. Also sends head-requests to determine if the 'latest' schema.org version is really 'fetch-able'. If not, this head-requests are done again for older versions until the latest valid version is determined and saved in the cache. It is possible to reset the cache with the parameter cacheClear.

      Parameters

      • cacheClear: boolean = false

        If true, delete the local cache of the version file and retrieve it again. (default = false)

      • Optionalcommit: string

        The commit string from https://github.com/schemaorg/schemaorg which is taken as source (if not given, the latest commit of our fork at https://github.com/semantifyit/schemaorg is taken). Use this parameter only if you want to change the schema.org repository used as source for the schema versions file. By standard, SDO Adapter uses a fork of the schema.org repository, which is updated only when schema.org releases a new vocabulary version, and that version passes all tests of SDO Adapter.

      Returns Promise<VersionsFile | VersionsFileSemantify>

      The version file as JSON object

      const { SOA } = require("schema-org-adapter");

      // version file needed for the first time -> the file is fetched and then saved in cache
      let schemaVersions = await SOA.fetchSchemaVersions();

      // version file already in cache -> no fetching needed
      schemaVersions = await SOA.fetchSchemaVersions();

      // passing cacheClear = true -> the file is fetched and then saved in cache again
      schemaVersions = await SOA.fetchSchemaVersions(true);