A fully self-contained HubSpot CMS theme that can be used as a base for any new project. Previously a child theme, it now includes all necessary assets and operates as an independent theme.
- Create a HubSpot development sandbox for testing and development purposes. Link
- Create a personal CMS access key to enable authenticated access to your account. Link
- Install rh CLI
npm -g install @resultify/rh-cli
rh init
rh- list of possible commands to run based on current working directoryrh upload- uploads all files to the HubSpot portalrh fetch- fetches all files from the HubSpot portalrh watch- watches the project for changes and uploads them to the HubSpot portalrh build- builds the projectrh uploadDb- uploads HubDb database to the HubSpot portalrh fetchDb- fetches HubDb database from the HubSpot portalrh browsers- list of supported browsers for the project
Access key for use with one project only
- Add
.envfile to root folder of your project - Add a name of your project Hubspot portal prefixed by
hub_with associated personal access key to it
hub_projectname=personal-access-key-for-this-portalnameAccess keys that can be used with different projects
- Add access keys to
~/.rh/.env.rootfile
hub_sandbox=personal-access-key-for-this-sandbox-portal
hub_sandbox2=personal-access-key-for-this-sandbox2-portal
hub_resultifydemo=personal-access-key-for-this-hub_resultifydemo-portal
GITHUB_TOKEN=GitHub Classic Personal access token with full repo scope is requiredThere are a couple of ways to set up events in HubSpot. You can either upload the predefined HubDb tables with random events data, setup the tables without sample event date and event or generate random data for them with updated dates information. First option is the easiest, but the placeholder events will be out of date.
*Events will be out of date, if necessary update them manually in the HubDb tables.
- Upload
event_informationtable (pickevent_information.jsonfile in CLI select box)
hs uploadDb- Copy table ID from just uploaded 'event_information' table and paste it to
event_date.jsonfile inforeignTableIdfield. - Upload
event_datetable (pickevent_date.jsonfile in CLI select box)
hs uploadDb- Create HubDB table Event information.
hs hubdb create ./.hubdb/event_information.hubdb.json-
Check result, should be something like :
[SUCCESS] The table <TABLE_ID> was created in <HUB_ID> with 0 rows. Edit file.hubdb/event_date.hubdb.jsonand temporary change "foreignTableId" value in "event_information" field to <TABLE_ID>. -
Create HubDB table Event date.
hs hubdb create ./.hubdb/event_date.hubdb.json- Edit file
.hubdb/event_date.hubdb.jsonand restore "foreignTableId" value in "event_information" field.
- Generate hubdb json files that includes example data.
node .hubdb/generateEventData.cjsWill create two new files in .hubdb folder, event_information_with_sample_data.hubdb.json and event_date_with_sample_data.hubdb.json.
- Create HubDB table Event information with sample data.
hs hubdb create .hubdb/event_information_with_sample_data.hubdb.jsonCheck result, should be something like : [SUCCESS] The table <TABLE_ID> was created in <HUB_ID> with 10 rows.
Edit file .hubdb/event_date_with_sample_data.hubdb.json and temporary change "foreignTableId" value in "event_information" field to <TABLE_ID>.
- Create HubDB table Event date with sample data.
hs hubdb create .hubdb/event_date_with_sample_data.hubdb.json- Edit file
.hubdb/event_date_with_sample_data.hubdb.jsonand restore "foreignTableId" value in "event_information" field.
The "Event list module" is dependent on GraphQL to fetch the information from HubDB.
-
Go to the Design Manager.
-
Create a folder in the theme and name it
data-queries. -
Inside the folder, create a new file. Select GraphQL in the filetype dropdown selector. Name it
events. Then publish the empty file once (make sure it succeeds). Then paste in the contents from/theme/data-queries/events.graphqland publish it again.
If a page displaying events already exists in HubSpot, remember to set "Dynamic pages" -> "Data source" to "Event information" in page advanced settings.
You also need to select "Event information" on each "Event date" since it isn't set in example data.
The sample events are in sv and en, so page language needs to be selected.
-
Create a Page:
- Select "Events template" as the page template.
- Edit the page settings.
-
Enable Featured Image:
- Ensure the featured image is enabled for the page.
-
Set Template:
- The template used on this page should be "event-view.html".
-
Set Page Language:
- If multiple languages are used, set the page language.
- The page language should match the "Language" column in the Event date to be displayed on the page.
- In Events list view, all tags from tags in list are collected and used in the Tag filter.
- Create one tag per language in Tags column, and select tags in correct language per Event date language.
-
Configure Dynamic Pages:
- Set the "Data source" to "Event information".
To setup the database tables in your Hub portal, start by uploading "Success Metrics" table, followed by "Case Study", in the following way:
-
Upload Success Metrics
- In the terminal, run
rh uploadDb - Select your portal, choose Yes and then pick the file
success_metrics.jsonand upload it. - Now run
rh fetchDbinstead, select your portal and choose Yes. You will now see a list of the tables, including their id. Copy the id fromsuccess_metrics. Then exit by pressing enter without selecting anything.
- In the terminal, run
-
Upload Case Study
- Edit the file
/hubdb/case_study.jsonand search forsuccess_metrics. Update the foreignTableId by pasting your new id into the value and save the file. - Now run
rh uploadDb, select your portal, choose Yes and then pick the filecase_study.json. - You should now have 2 new tables in your HubDb (in your portal) complete with some example content. You will still need to hook up some of the Success Metrics to each row in the Case Study table manually, if you want to use them.
- Edit the file
Note: In HubDB, for the case_study table, please check the Actions > Manage settings. Make sure Meta description column is set to meta_description and Featured image column is set to summary_featured_image (or whatever image you like). In our testing, these fields seems to not be selected properly when uploaded.