Back to Content Management API

siteSettings

Returns the site settings in a draft or published state.

Arguments

  • Name
    id
    Type
    ID
    Description

    The ID of the site settings. Optional, since each content environment has one site settings record.

  • Name
    version
    Type
    Version
    Description

    The state of the site settings you want to retrieve.

    • To get the latest content use CURRENT.
    • To get the latest published content use PUBLISHED

Returns

Request

import { PackClient } from '@pack/client'
const packClient = new PackClient({
  token: 'YOUR-PACK-TOKEN'
});

const query = `
query GetSiteSettings($version: Version) {
  siteSettings(version: $version) {
    id
    revisionId
    seo {
      title
      description
      keywords
    }
  }
}
`
const variables = {
  version: 'CURRENT',
}
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);

Response

{
    "data": {
        "siteSettings": {
            "id": "site-settings-id",
            "revisionId": "revision-id",
            "seo": {
                "title": "SEO Title",
                "description": "SEO Description",
                "keywords": ["keyword-one", "keyword-two"]
            }
        }
    }
}

Was this page helpful?