code: def doctree_read_handler(app, doctree):
      
      # noinspection PyProtectedMember
      docname = sys._getframe(2).f_locals['docname']
      if docname.startswith('_partial'):
          app.env.metadata[docname]['orphan'] = True
docs: Add 'orphan' to metadata for partials
  
      :type app: sphinx.application.Sphinx
      :type doctree: docutils.nodes.document