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
- To get the latest content use
To get localized content, pass language and country to the @inContext directive on the query instead. See Localization.
Returns
- Name
SiteSettings.*- Type
- SiteSettings
- Description
Any requested field from the SiteSettings object.
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"]
}
}
}
}