Add Google Chart to HUGO markdown (.md) file

I posted the following question on stackoverflow:

I have started to create a Hugo website using the following theme: https://themes.gohugo.io/theme/academic/. I would like to add a Google Chart.

Question: How can I add a google chart as the [header] to a page created by the following .md file?

The example code it posted on stack. I am wondering if someone might know the answer on Hugo Discussion.

Thank you

Create a partial with the JS and HTML needed to render the chart.

In your front matter do something like

---
header_after_something:
  - googleChart
---

Now in your header template write a function to check if header_after_something exists and if so loop over the list and for each member in the list load the partial with that name.