Skip to content

Leveraging the Power of Dynamic Pages with HubSpot

In the rapidly evolving digital landscape, the need for personalised, engaging, and efficient web content is paramount. One of the ways businesses are meeting this demand is through the use of dynamic pages. But what exactly are dynamic pages and how can they be utilised to their full potential?

Dynamic pages in HubSpot are a type of web page that are dynamically created based on the URL. Typically one creates a listing page that will showcase various links to the dynamic pages. Below you will see a styled list that uses data in a HubDB table to provide links to the individual pages. We will show you the code later. Just realise that if we would add or amend one of the rows (= books) in the database, it would auto-update.

The cool thing however is not the listing page, but the dynamic pages themselves: we create one, and HubSpot does the rest.

So in our case if you click on a link, it will load a page that checks which book it will need to show the details from. This happens based on the last part of the URL, which we have set to include the name of the book in the listings page.

HubSpot's own documentation shows how to make a full page dynamic. We never use full pages but always modules. This allows more flexibility as you can mix and match standard content and smart content with dynamically generated content. The standard and smart content can later be amended by any marketeer without any need to understand code. This also means the developers can focus on just the part that they need to focus.

Here is what we cooked up for the listing:

The Psychology of Money

by Morgan Housel

Book cover The Psychology of Money

Summary of "The Psychology of Money" by Morgan Housel

Money isn't just about math—it's about behavior. And let's be real, people are terrible at behaving rationally. This book dives into why even the smartest people make dumb financial decisions, and why ordinary folks can end up wealthy if they master a few key behavioral principles.

Key Points:

  • No One’s Crazy
    Everyone has a unique experience with money based on their upbringing and personal history. What seems insane to you might make perfect sense to someone else because they’re dealing with a different set of experiences and biases.
  • Luck & Risk
    Success in investing isn’t just about being smart. Luck plays a massive role. Bill Gates went to one of the only high schools in the world that had a computer. Meanwhile, equally talented people might never get such a lucky break. Recognize the role of luck in your success and don't judge others too harshly for their failures.
  • Never Enough
    People ruin their lives by not knowing when to stop. Case in point: Rajat Gupta was worth $100 million but wanted to be a billionaire so badly that he engaged in insider trading. He ended up in prison. The takeaway? Know when you have enough.
  • Confounding Compounding
    Compounding is the most powerful force in finance. Warren Buffett's wealth isn't just because he's a good investor—it's because he started early and kept at it for decades. If you want to build wealth, start now and let compounding do its magic.
  • Getting Wealthy vs. Staying Wealthy
    Getting rich and staying rich are different skills. The former requires taking risks and being optimistic, while the latter requires humility and fear. Stay paranoid about the risks that could wipe you out.
  • Tails, You Win
    Financial success often comes from a few big wins rather than consistent small gains. Invest in opportunities where the payoff could be huge, even if the odds seem long.
  • Freedom
    The ultimate goal of money is to give you control over your time. Forget about keeping up with the Joneses. The real flex is being able to do what you want, when you want.
  • Man in the Car Paradox
    People buy flashy cars and big houses to impress others, but no one cares. They’re too busy thinking about their own lives. Live below your means and invest the difference.
  • Wealth is What You Don’t See
    Wealth is the income you don’t spend. Flashy displays of wealth often mean someone is bad at managing money. The real wealthy are those who have money saved and invested.
  • Save Money
     Saving is the gap between your ego and your income. The best way to build wealth is to live below your means. No fancy strategy needed—just spend less than you earn.
  • Reasonable > Rational
    People are not spreadsheets. Making financial decisions that are reasonable for you, given your personal situation and psychology, is often better than being perfectly rational.
  • Surprise!
    The most important events in history are the big surprises. Plan for things to go wrong, because they will. Build a margin of safety into your financial plans.
  • Room for Error
    The most important part of every plan is planning on your plan not going according to plan. Always have a buffer for when things go south.
  • You’ll Change
    Your goals and desires will change over time. Be flexible with your financial plans and be prepared to adjust as your life evolves.
  • Nothing’s Free
    Everything has a price, but not all prices appear on labels. The price of getting rich is the volatility and uncertainty of the market. Embrace it as the cost of admission.
  • You & Me
    Your financial decisions should be personal. Just because someone else is doing something doesn’t mean it’s right for you. Stay in your lane.
  • The Seduction of Pessimism
    Optimism sounds like a sales pitch, but pessimism sounds like someone trying to help you. Don’t get seduced by negative news—long-term progress is overwhelmingly positive.
  • When You’ll Believe Anything
    We believe what we want to believe, and that’s often not the truth. Be wary of your own biases and be willing to challenge your beliefs.
  • All Together Now
    Financial success isn’t about making one great decision—it’s about consistently making good decisions over time. Small habits compound into great results.
  • Confessions
    The author’s own financial journey is full of mistakes and learning. The biggest lesson? Stay humble, keep learning, and never think you’ve got it all figured out.

    In a nutshell, money management is more about behavior than brains. Master your emotions, live below your means, and start early. The rest will follow.

So how did we create this?

In this case we started off with the simplest way to do it: create one single module that checks if it is on a dynamic page or not. And acts accordingly. This is following the example of the HubSpot documentation. In our example of dynamic pages build on custom objects we have actually split up the modules, so note that can be done just as well.
As you can see in the code below the module just includes 8 lines of HTML to present the 'details' page, and another 27 for the index page.

The same HubDB table that powers this page also powers the programmable email demo.

{% if dynamic_page_hubdb_row %}
  <!-- This will only execute if it is the books-detail page. NOT if it is the books index page -->
  <h1>{{ dynamic_page_hubdb_row.title }}</h1>
  <h3>by {{ dynamic_page_hubdb_row.author }}</h3>
  <div class="details-img">
    {% image "book-cover" label="Book cover" alt="Book cover {{ dynamic_page_hubdb_row.title }}" src="{{dynamic_page_hubdb_row[6].url}}" width="300" %}
  </div>
  {{ dynamic_page_hubdb_row.review }}
{% elif dynamic_page_hubdb_table_id %}
  <!-- This will only execute if it is the books index page -->
  <div class="card-grid">
    {# retrieve each row #}
    {% for row in hubdb_table_rows(module.hubdbtable) %}
      <a href="{{ row[9] }}" aria-label="Read more about {{ row.title }}">
        <div class="card">
          <div class="card-img">
            {% image "book-cover" label="Book cover" alt="Book cover {{ row.title }}" src="{{row[6].url}}" width="300" %}
          </div>
          <div class="card-body">
            <p class="card-author">
              Author: {{ row.author }}
            </p>
            <p class="card-genre">
              Genre:
              {# loop through genres #}
              {% for genre in row[7] %}
                {{ genre.name }}{% if not loop.last %}, {% endif %}
              {% endfor %}
            </p>
          </div>
        </div>
      </a>
    {% endfor %}
  </div>
{% endif %}
.card {
  background: white;
  transition: background-color 0.3s ease;
  border-radius: 15px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
  margin: 20px;
  max-width: calc(100% - 40px);
  overflow: hidden;
  display: inline-block;
}

.card:hover {
  background: rgba(211, 254, 255, 0.5);
}

.card a {
  color: inherit;
  text-decoration: none;
  display: block;
}

.card-img {
  width: calc(100% - 30px);
  height: 450px;
  overflow: hidden;
  margin: 15px;
  border: 1px solid #4eaae3;
  box-shadow: 0 0 5px 5px rgba(211, 254, 255, 0.85);
  box-sizing: border-box;
}

.card-body {
  padding: 20px;
}

.card-title {
  margin: 0 0 10px 0;
}

.card-genre, .card-author {
  font-size: 0.9em;
  color: #666;
}

.card-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.details-img img {
    float: right;
    margin-left: 20px;
    margin-bottom: 20px;
    border: 1px solid #4eaae3;
    box-shadow: 0 0 5px 5px rgba(211, 254, 255, 0.85);
}
[
 {
  "display_width": null,
  "id": "bba54aae-4637-3ef7-25cb-2472b159446c",
  "label": "HubDB table",
  "locked": false,
  "name": "hubdbtable",
  "required": true,
  "type": "hubdbtable"
 }
]