From 0662a3ecd6ecce3ababc35036d858543a9d3e132 Mon Sep 17 00:00:00 2001 From: Timotheus Kampik Date: Mon, 8 Jul 2019 22:48:41 +0200 Subject: [PATCH] #6503 document meta directive (#6562) #6503 document meta directive The `meta` directive has partly Sphinx-specific behavior and hence needs to be documented --- doc/usage/restructuredtext/basics.rst | 42 ++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/doc/usage/restructuredtext/basics.rst b/doc/usage/restructuredtext/basics.rst index 1f36cdc400..dffaf297ca 100644 --- a/doc/usage/restructuredtext/basics.rst +++ b/doc/usage/restructuredtext/basics.rst @@ -372,7 +372,8 @@ Docutils supports the following directives: * HTML specifics: - - :dudir:`meta` (generation of HTML ```` tags) + - :dudir:`meta` + (generation of HTML ```` tags, see also :ref:`html-meta` below) - :dudir:`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 `) 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 + + + + +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 ---------------