Optimizely Content Graph: minimal setup for testing
1. Create a test page:
[ContentType(DisplayName = "Test Page",
GUID = "462d1812-7385-42c3-8073-c1b7481e7b21",
Description = "TestPage",
AvailableInEditMode = true,
GroupName = GroupNames.Content)]
public class TestPage : PageData
{
[CultureSpecific]
[UIHint(UIHint.Textarea)]
[Display(Name = "Test", GroupName = SystemTabNames.Content, Order = 1)]
public virtual string Test { get; set; }
}
services.AddContentGraph(configureOptions: options =>
{
options.SynchronizationEnabled = false;
options.Include.ContentTypes = new string[] {
typeof(TestPage).Name,
};
options.OnlySyncContentTypesInWhitelistToSchema = true;
options.ContentVersionSyncMode = Optimizely.ContentGraph.Cms.Configuration.ContentVersionSyncMode.PublishedOnly;
});
3. Create a test page in UI
4. Run the index job again
{
"took": 0,
"errors": false,
"items": [
{
"index": {
"Status": 201,
"_index": "addea184b3064d2d988149fb0208784e_en.v1",
"_id": "37e940ed-c5b0-477c-9248-9f288f5fddd2_en_Published",
"Result": "created"
}
}
],
"executedAt": "0001-01-01T00:00:00",
"source": null,
"id": "9ba4b13c-b280-4e78-985c-95970c23a182",
"createdAt": "2024-09-06T11:06:13.4418993+00:00"
}
5.Test to see if it's shown in index:

query MyQuery {
TestPage {
items {
Name
Url
Changed
}
}
}

From here we can start trying with our own content type to make sure all of them are working as expected or just some of them.
Comments
Post a Comment