DevHub API Documentation
  • Introduction
  • Authentication
  • Errors
  • Getting started guides
    • Business-focused Sites
    • Location-focused Sites
    • Location pages and store locator with custom theme
    • Site publishing with site builder access
  • Code examples
    • Python
    • PHP
    • Perl
  • Best practices
    • Our unique IDs, versus yours
    • State and country codes
  • Core Resources
    • Sites
    • Businesses
    • Locations
    • Domains
    • Proxies
  • Content Resources
    • Pages
    • Content
    • Images
    • Files
    • Modules
    • Plugins
    • Themes
  • Logging and analytics
    • Analytics
    • Contact Logs
  • Single Sign On (SSO)
    • Introduction
    • Assigning a site's user
  • Live Preview API
    • What is the Live Preview API?
  • Advanced
    • Domain aliases
    • Language codes
    • Projects
    • Site Check
    • Traces
    • Webmail
  • Local Storage API
    • What is the Local Storage API?
  • Headless CMS
    • Locations search
  • Visitor Localization SDK
    • Visitor Localization SDK
Powered by GitBook
On this page
  • Overview
  • Business
  • 1. Create a Business
  • Custom theme
  • 1. Create the custom theme
  • 2. Create a Site that will be used as the "master template" content
  • 3. Enable theme as master template pointing to the site_id from above
  • Locations and location pages
  • 1. Create a location
  • 2. Create a location page (site)
  • Store locator
  • 1. Create the store locator site
  • 2. Update the home page to add the default Store Locator module

Was this helpful?

  1. Getting started guides

Location pages and store locator with custom theme

Start to finish examples of creating everything you need for location pages and a store locator

PreviousLocation-focused SitesNextSite publishing with site builder access

Last updated 6 years ago

Was this helpful?

Overview

The goal of this guide is to illustrate how you would create

  • for a theoretical customer "ABC Brand" which all locations and sites will be published under

  • that will be used to customize the header, footer, and style used on the Store Locator page and each Location Page

  • for each location which will be set to locations.abcbrand.com/location-slug/

  • site that will be setup to be hosted under locations.abcbrand.com/

Note: Each instance of our platform is configured with a "directory depth" that is used to specify what the URLs will look like for each of the Sites. In the below example, it is set to 1 which would allow you to publish sites under /example-location-slug/

Business

1. Create a Business

Using the

POST /api/v2/businesses/

{
  "business_name": "ABC Brand"
}

The returned business.id will be used in later requests

Custom theme

1. Create the custom theme

You will use the returned theme.id in later requests

2. Create a Site that will be used as the "master template" content

POST /api/v2/sites/

{
  "business_id": BUSINESS_ID,
  "base_directory": "/master-template/",
  "formatted_domain": "locations.customerbrand.com",
  "title": "Location Page Master Template",
  "theme_id": THEME_ID
}

3. Enable theme as master template pointing to the site_id from above

PUT /api/v2/themes/:theme_id/

{
  "site_overrides": {
    "en": SITE_ID
  },
  "site_override_objects": [
    "linklists",
    "pages",
    "plugins"
  ]
}

Locations and location pages

For each location, we will be creating a location and a location page (site)

1. Create a location

POST /api/v2/locations/

{
  "business_id": BUSINESS_ID,
  "street": "555 Main St",
  "city": "Seattle",
  "state": "WA",
  "postal_code": "98121",
  "country": "US",
  "phones": [
    {
      "type": "phone",
      "number": "(206) 555-5555"
    }
  ],
  "location_url": "http://locations.abcbrand.com/seattle/"
}

You will use the returned location.id in the next request

2. Create a location page (site)

POST /api/v2/sites/

{
  "base_directory": "/seattle/",
  "business_id": BUSINESS_ID,
  "formatted_domain": "locations.abcbrand.com",
  "locations": [LOCATION_ID],
  "published": true,
  "theme_id": THEME_ID,
  "title": "Seattle Location Page"
}

Store locator

1. Create the store locator site

POST /api/v2/sites/

{
  "base_directory": "/lp/",
  "business_id": BUSINESS_ID,
  "formatted_domain": "locations.abcbrand.com",
  "published": true,
  "theme_id": THEME_ID,
  "title": "Store Locator"
}

The returned site.id will be used in later requests

2. Update the home page to add the default Store Locator module

In step 1, the site that was created has a blank home page. So we will now update the home page to add the store locator. This will also override the default location page (site) content that would normally show for that theme_id

1. Find the current home page

GET /api/v2/pages/?site_id=:site_id

{
  "objects": [
    {
      "id": 123,
      "path": "/",
      "name": "Home"
    }
  ]
}

2. Update the home page

PUT /api/v2/pages/:page_id/

{
  "column_widths": [[100]],
  "modules": [
    {
      "column": 1,
      "module": "multilocation",
      "order": 1,
      "props": {
        "is_location_finder": true,
        "location_finder_version": "v2",
        "within_business": true
      },
      "row": 1
    }
  ]
}

A with header and footer and location page content is added here

See

Assign the theme_id from above to that . We will leave this Site as unpublished as it is only used as a template.

For more details on site override view

and also pass the location_url which is used to link to the location page from the store locator.

under the same location_url from above and using the business_id, location_id, and theme_id from previous requests.

We will then publish a Store Locator under locations.abcbrand.com and we will pass /lp/ as the base_directory which is a special method to support rendering the store locator under the root domain.

We will (there should only be one) and use it's page.id to update the content in the next step. The home page will be the one with the path set to / (slash)

Theme
Businesses resource
A business
A custom theme
Locations and their associated location pages
A Store Locator
Example request to create a custom theme
here
grab all the pages under the Site
Update the Page detail
new Site
Create a location page (site)
site
Create a location