OK - I had to go back to the documentation page (Build dynamic pages using HubDB - HubSpot docs)to make sure that I wasn’t completely missing the support mechanics here, although they do seem to skip a step or two. I tend to use somewhat different ways to exploit HubDB data, but this looks like a fairly standard path.
I’ts clear you have 90% of this working already, so hopefully this helps complete things for you.
Assuming you CMS template structure is pretty conventional, you are looking already at base.html - which in my theme has the statements:
<title>{{ page_meta.html_title }}</title>
<meta name=“description” content=“{{ page_meta.meta_description }}”>
This is where the standard pages get the data entered into the page editor settings dialogs into title and description into the actual page HTML.
It seems you have two options to customize the metadata:
- Set up the content required explicitly in each row of your HubDB table in the extra hs_name column that’s added when you configure the HubDB table for dynamic page generation.
- Use a macro variable reference {{ dynamic_page_hubdb_row.name }} to get hold of the contents of the name column of your table (or whatever hold teh right data) and format the title string in the manner you would like - for example:
<title> “Faculty member {{ dynamic_page_hubdb_row.name }}” </title>
And similarly set up the custom meta description.
I might do this in a clone of the base.html and use that clone reference in your actual page template file. But it also seems that you may be able to detect the use of dynamic pages on the fly using:
{% if dynamic_page_hubdb_row %}
and adapt the generic base.html code to deal with standard and dynamic cases.
Hope I’m on the right track here.
Steve