getContentIdentifier

Function
import { getContentIdentifier } from "@esri/hub-common";
//
getContentIdentifier(content, site)
> 'f12hhjk32' // id
// OR
> 'content-slug' // human-readable slug

Returns the preferred identifier for a piece of content (determined by content type):

  • Content from the 'template' and 'feedback' families return the standard id field
  • Pages that are linked to the site parameter will return the slug defined by the site. Otherwise, the page id will be returned
  • All other content will return the highest available item in the following hierarchy:
    1. slug - includes org prefix if the site parameter is a portal or has an orgKey different from the slug prefix
    2. hubId
    3. id

Parameters

Parameter Type Default Notes
content Required IHubContent

The IHubContent item

site Optional IModel

The site to compare content against

Returns

the preferred id for the given content.

string

Function defined in common/src/content/contentUtils.ts:123