Websites frequently have content that is shared across all pages — think logos, taglines, site names, etc. It is a best practice to have a single source of truth so that any changes will propagate across your entire site. This helps make updates easier and ensures brand unity.
In this scenario, you can use the Knowledge Graph to power global data, which is accessible across all pages on your site — both static and stream-powered pages.
Common global data use cases include your brand's:
- Name
- Primary and secondary color hex values
- URL links for your header and footer
- Image URL or path for your logo
- Yext Account ID
At a high level, you'll need to create a site entity in the Knowledge Graph to store the content, and then create a site stream in your repo to pass that data in to be used across templates.
Create a Site Entity
First, create a site entity type and create one entity of that type. While the entity type and schema can be anything you want, we recommend the following conventions:
- Create a new
Siteentity type. - Add any fields to this entity type that you'll want to leverage across pages of the site.
- Create a single instance of your new
Siteentity type. - Populate the fields on the entity with content you want to make accessible across your site.
This entity should include all of the content you would like to access across pages (e.g., a logo for the header, relevant links for the footer). It could look something like the following:

Set Up a Site Stream
Once the entity is created, define a site stream in config.yaml filtered to the site entity. Note that unlike a stream in a template, this stream filters by entityIds and not entityTypes.
When configuring the stream, pay attention to these key fields:
-
fields— Delete any fields you're not using and add any fields you want to use. -
entityId— Make sure the entity ID in the stream matches that of the site entity you created in the Knowledge Graph. -
locales— The default locale isen. Update this to change or add other locales.
Below is an example stream definition:
# The site stream allows for specification of site entity whose data will be injected to all
# generation contexts under the `_site` property.
siteStream:
id: site-stream
entityId: site
fields:
- name
- logo
localization:
locales:
- en
transform:
replaceOptionValuesWithDisplayNames:
- c_singleOptionFieldList
expandOptionFields:
- c_singleOptionFieldList
Stream Properties
-
id— A unique identifier for the site stream configuration. -
entityId— The ID of the site entity in the Knowledge Graph. This entity typically contains information relevant to the entire website, such as global settings or site-wide metadata. -
fields— An array of the Knowledge Graph field IDs from the site entity to include in the_siteobject. -
localization— Localization settings for the site stream.-
locales— An array of locale strings. Just like template streams, you can localize your site stream data. Learn more in the Multiple Language Support reference doc.
-
-
transform— Allows you to transform certain data from the Knowledge Graph on the server side.-
replaceOptionValuesWithDisplayNames— For option-select fields, this transform returns the display name of your option values instead of the IDs. We always recommend using this transform when returning any option-select fields in yourfieldsarray. -
expandOptionFields— For option-select fields, this transform returns all possible options for that field, as opposed to only the selected option.
-
Access Site Data
Once the site stream is configured, you can access the site data in any template via a new field on document named _site. This property will contain any of the fields specified in the stream definition above.
Here is an example of a template that uses global data:
const Static: Template<TemplateRenderProps> = ({ document }) => {
const { _site } = document;
return (
<Layout footer={<div>©️ {_site.name}</div>}>
<div>Hello World</div>
</Layout>
);
};
Try pulling global data into the header or footer of your site. You can replace hardcoded values with _site.name if you configure site name in your Site entity, and do the same for logos, social links, and more.
Note: Global data is accessible on static pages as well as stream-powered pages. Even though each static page isn't backed by an individual entity in the Knowledge Graph, a static page will reflect updates to global data.