Add Metadata to html file

I wonder if there is a standard way of adding extra metadata (e.g. description) to the html header when saving a plot by using hv.save(). I am thinking about using something like the BeautifulSoup package but I would be pleased if I can just add the metada before I create the html file.

1 Like

You can provide a custom jinja2 template to the pn.save method which will let you override the contents of the HTML however you want:

import panel as pn
import holoviews as hv

hv.extension('bokeh')

template = """
{% block preamble %}
      <meta charset="UTF-8">
      <meta name="description" content="Some description">
      <meta name="keywords" content="Panel, Template, Save">
      <meta name="author" content="Philipp Rudiger">
{% endblock %}
"""

pn.Column('# A title', hv.Curve([1, 2, 3])).save('test.html', template=template)
1 Like

For more details on Panel/Bokeh templates see: Templates — Panel 0.11.3 documentation

1 Like