General Variables
General Variables for Resources
Section titled “General Variables for Resources”When any resource is published or updated in Sanity, the getResourcesData() function fetches a set of shared variables that apply to all content types in the dev_Resources_NET index. These variables are used for filtering and display in the Resource Center.
Source file: algolia/custom_actions/types/getResourcesData.js
Shared Fields
Section titled “Shared Fields”The following fields are fetched for every resource type:
| Variable | Fetch Method | Description |
|---|---|---|
typeName | client.fetch(queryTypeName) | Localized display name of the content type |
topics_slug | fetchTopics() | Array of topic slugs for filtering |
topics_text | fetchTopics() | Topic display text (returned alongside slugs) |
topics_languages | fetchTopicsLanguages() | Localized topic names across all languages |
solutions_slug | fetchTaxRepeaterSlug() | Array of solution taxonomy slugs |
industries_slug | fetchTaxRepeaterSlug() | Array of industry taxonomy slugs |
products_slug | fetchTaxRepeaterSlug() | Array of product taxonomy slugs |
technology_slug | fetchTaxRepeaterSlug() | Array of technology taxonomy slugs |
compliance_slug | fetchTaxRepeaterSlug() | Array of compliance taxonomy slugs |
regions_slug | fetchTaxRepeaterSlug() | Array of region slugs (excludes podcasts and events) |
countries_slug | fetchTaxonomiesSlug() | Array of country slugs |
taxonomy_slug | fetchTaxRepeaterSlug() | Array of event type slugs |
main_topic | fetchMainTopic() | Primary topic reference |
Code Reference
Section titled “Code Reference”const getResourcesData = async () => { ... // Fetch localized type display name var queryTypeName = `*[_type == 'post_type_names'][0].${type}` typeName = await client.fetch(queryTypeName)
// Topics (slugs + display text) var resulttopics = await fetchTopics(props, client); topics_slug = resulttopics.topics_slug let topics_text = resulttopics.topics_text
// Localized topic names topics_languages = await fetchTopicsLanguages('topics', 'topics', props, client)
// Taxonomy slugs (solutions, industries, products, etc.) solutions_slug = await fetchTaxRepeaterSlug('solutions', 'solutions_tax', props, client) industries_slug = await fetchTaxRepeaterSlug('industries', 'industry_tax', props, client) products_slug = await fetchTaxRepeaterSlug('products', 'products_tax', props, client) technology_slug = await fetchTaxRepeaterSlug('technology', 'technology_tax', props, client) compliance_slug = await fetchTaxRepeaterSlug('compliance', 'compliance_tax', props, client)
// Regions (not for podcasts or events — they handle regions differently) if (type != 'podcasts' && type != 'events') { regions_slug = await fetchTaxRepeaterSlug('region', 'events_regions_tax', props, client) }
// Countries and event types countries_slug = await fetchTaxonomiesSlug('country', 'countries', props, client) taxonomy_slug = await fetchTaxRepeaterSlug('reference', 'event_types', props, client) main_topic = await fetchMainTopic('main_topic', 'topics', props, client)
// Events use a different fetch method for taxonomy if (type == 'events') { taxonomy_slug = await fetchTaxonomiesSlug('reference', 'event_types', props, client) }}- Podcasts and Events handle
regions_slugseparately in their own type-specific logic. - Events override the
taxonomy_slugwith a different fetch method (fetchTaxonomiesSluginstead offetchTaxRepeaterSlug). - Each content type adds type-specific fields on top of these general variables. See the individual content type pages for details.