mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-11-02 20:30:30 -06:00
#6503 document meta directive The `meta` directive has partly Sphinx-specific behavior and hence needs to be documented
This commit is contained in:
1 parent
1c152d249c
commit
0662a3ecd6
1 file changed
+41
-1
@@ -372,7 +372,8 @@ Docutils supports the following directives:
|
||||
|
||||
* HTML specifics:
|
||||
|
||||
- :dudir:`meta` (generation of HTML ``<meta>`` tags)
|
||||
- :dudir:`meta`
|
||||
(generation of HTML ``<meta>`` tags, see also :ref:`html-meta` below)
|
||||
- :dudir:`title <metadata-document-title>` (override document title)
|
||||
|
||||
* Influencing markup:
|
||||
@@ -538,6 +539,45 @@ You can indent text after a comment start to form multiline comments::
|
||||
Still in the comment.
|
||||
|
||||
|
||||
.. _html-meta:
|
||||
|
||||
HTML Metadata
|
||||
-------------
|
||||
|
||||
The :rst:dir:`meta` directive (:dudir:`ref <meta>`) allows specifying the HTML
|
||||
`metadata element`_ of a Sphinx documentation page. For example, the
|
||||
directive::
|
||||
|
||||
.. meta::
|
||||
:description: The Sphinx documentation builder
|
||||
:keywords: Sphinx, documentation, builder
|
||||
|
||||
will generate the following HTML output:
|
||||
|
||||
.. code:: html
|
||||
|
||||
<meta name="description" content="The Sphinx documentation builder">
|
||||
<meta name="keywords" content="Sphinx, documentation, builder">
|
||||
|
||||
Also, Sphinx will add the keywords as specified in the meta directive to the
|
||||
search index. Thereby, the ``lang`` attribute of the meta element is
|
||||
considered. For example, the directive::
|
||||
|
||||
.. meta::
|
||||
:keywords: backup
|
||||
:keywords lang=en: pleasefindthiskey pleasefindthiskeytoo
|
||||
:keywords lang=de: bittediesenkeyfinden
|
||||
|
||||
adds the following words to the search indices of builds with different language
|
||||
configurations:
|
||||
|
||||
* ``pleasefindthiskey``, ``pleasefindthiskeytoo`` to *English* builds;
|
||||
* ``bittediesenkeyfinden`` to *German* builds;
|
||||
* ``backup`` to builds in all languages.
|
||||
|
||||
.. _metadata element: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
||||
|
||||
|
||||
Source encoding
|
||||
---------------
|
||||
|
||||
|
||||
Reference in new issue
Block a user