How to create a glossary in Sphinx?

How to create a glossary in Sphinx?

This is not difficult. Simply add a glossary directive in your document and include all your terms and definitions in it. You could have more than one glossary of course (perhaps for different audiences), but that is basically it. See https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#glossary-directive.

But the question is more complicated than that. You are trying to do something with the glossary directive that is not supported.

A glossary without terms and definitions is meaningless. I don't see any terms and definitions in your reST examples.

You seem to want some kind of index, generated by markup in the document. And Sphinx can generate a general index, with page numbers, automatically (I suppose you already know this). There is an index directive, and also an index role for defining index entries. But since you insist on using glossaries for this, the question becomes confusing and I am still not completely sure I understand what you want.

By the way, note that terms defined in a glossary show up in the automatically generated index (see Using noindex with glossary in Sphinx).

Moving on, let's assume that you have a section title (heading) that you want to be indexed:

About this Guide
****************

The simplest way to make the text of the heading show up in the generated index is to use an inline index role, like so:

:index:`About this Guide`
*************************

You can also use the block-level index directive:

.. index:: About this Guide

About this Guide
****************

If this answer is not what you are looking for, please clarify the question.