code: def stamp_title(kb_app: kb,
                  sphinx_app: Sphinx,
                  doctree: doctree):
      
  
      # First, find out which resource this is. Won't be easy.
      resources = sphinx_app.env.resources
      confdir = sphinx_app.confdir
      source = PurePath(doctree.attributes['source'])
  
      # Get the relative path inside the docs dir, without .rst, then
      # get the resource
      docname = str(source.relative_to(confdir)).split('.rst')[0]
      resource = resources.get(docname)
  
      if resource:
          # Stamp the title on the resource
          title = get_rst_title(doctree)
          resource.title = title
docs: Walk the tree and extra RST title into resource.title