Account Configuration | Yext Hitchhikers Platform
What You’ll Learn
In this section, you will learn:
- How to prepare Content to use the Yext Directory Manager
- How to configure the Directory Manager in Admin Console
Overview
Let’s start by configuring our account through the first two steps to creating a location directory:
- Prepare your Content
- Configure the Directory Manager
To start, you’ll need to set up your Content to support the new content the directory manager will need to create, including new entity types for each level and relationship fields to link entities to each other.
Then you’ll configure the Directory Manager to recognize the account setup it needs to create.
Prepare your Content
The first step to build a directory is to populate your Content with entities, entity types, and custom fields. These will be used by the Directory Manager to generate a directory for you.
This module assumes that:
- You created a repo using the
yext pages new
command per Module 1 . - You selected the Locations Starter (basic) template repo.
- Per step 6 in Module 1 , your account is already populated with seed data.
Please ensure you have completed the steps mentioned above before proceeding.
Account Configuration
In your Yext account, navigate to the Admin Console (hint: use Quick Find for this). You should see the following resource files in your account under the folders below:
- km > entity-type
root.json
state.json
city.json
These are custom entity types and fields that will be used by the Directory Manager in the next step. These must exist in order the Directory Manager to run successfully.
If you are going through this module using your own account data, you must ensure that you create your entity types before referencing them in a DM configuration file.
Configure the Directory Manager
Now that you have the necessary account setup, let’s go ahead and create a Directory Manager configuration in your account. Perform the following steps:
- In the top right section of your screen, click the Add Resource button.
- Click Pages > Directory Manager.
- Name your file
us-directory.json
.
- Name your file
Replace the existing contents of the
us-directory.json
file with the following JSON snippet. Then click Apply and follow the flow.{ "$id": "us-directory", "$schema": "https://schema.yext.com/config/pages/directory-manager/v1", "name": "US Directory", "baseEntities": { "entityTypes": ["location"] }, "root": { "entityType": "ce_root", "slug": "root.html" }, "localization": { "locales": ["en"] }, "levels": [ { "entityType": "ce_state", "field": "address.region", "slug": "{{address.region}}", "fieldMappings": { "c_addressRegionDisplayName": "{{#regionDisplayName}}" } }, { "entityType": "ce_city", "field": "address.city", "slug": "{{address.region}}/{{address.city}}", "fieldMappings": { "c_addressRegionDisplayName": "{{#regionDisplayName}}" } } ] }
This JSON object tells the Directory Manager how to construct the tree of entities in Content. Notice that it references the custom entity types and fields mentioned in the previous section.
At a high-level, this configuration defines the following:
Base Entities:
- The set of entities from which the tree will be constructed. You can think of this set as the “base” of your tree. This set is determined by entity types, and optionally saved filters.
Levels:
- The different levels of the tree. The DM will generate entities based on the logic specified at each level.
- In the example above, the DM will create city and state entities based on the
field
values from the base entities (address.city
andaddress.region
), and create relationships between them and all applicable base entities. - The DM can be configured to populate a
slug
value for each generated entity. In the example above, eachslug
is powered dynamically by theaddress.city
andaddress.region
values from the base entities. fieldMappings
is an optional object that allows you to map data from the base entities to fields on your tree entities. In this example, we’re using it to mapaddress.region
(which is a US state abbreviation) into a display name. Refer to the Directory Management reference doc to learn more about the configuration schema and all available properties.- In the next unit, you will see how this configuration directly ties into your entity tree.
Root:
- The root object allows you to generate a single entity that is the “parent” of all other nodes in the directory. This is typically used to power your index/home page. In the example above, the root entity would be the direct parent of all state entities.
Localization:
- The set of language locales that should be constructed for your directory entities, when applicable. Refer to the Multi-Language section of the Directory Management reference do for more information on how this works.