OpenGraph metadata and meta directive

44 views
Skip to first unread message

Denis Bitouzé

unread,
Dec 10, 2020, 9:38:39 AM12/10/20
to sphinx-users

Hi,

I'd like to add meta OpenGraph informations in my Sphinx doc. The meta

rST directive could be a nice solution:

  .. meta::
      :description: The reStructuredText plaintext markup language
      :keywords: plaintext, markup language

How can I use the meta directive with OpenGraph& obtain this output,
(with semi-colon in property...):

  <meta property="og:title" content="The Rock" /> ?

Thanks for any help on the subject.

Matthias Geier

unread,
Dec 11, 2020, 10:29:28 AM12/11/20
to sphinx...@googlegroups.com
Are you aware of the (currently unmerged) pull request
https://github.com/sphinx-doc/sphinx/pull/7974 which is supposed to
add OpenGraph support?

See also https://github.com/sphinx-doc/sphinx/issues/2645 and
https://github.com/sphinx-doc/sphinx/issues/6089.

cheers,
Matthias

Denis Bitouzé

unread,
Dec 11, 2020, 10:41:46 AM12/11/20
to sphinx...@googlegroups.com
Le 11/12/20 à 16h28, Matthias Geier a écrit :

> On Thu, Dec 10, 2020 at 3:38 PM Denis Bitouzé wrote:
>>
>> (This is exactly the same question as https://groups.google.com/g/sphinx-users/c/w4PejPV0W-o/m/32-IlUNzmF0J. )
>>
>> Hi,
>>
>> I'd like to add meta OpenGraph informations in my Sphinx doc. The meta
>>
>> rST directive could be a nice solution:
>>
>> .. meta::
>> :description: The reStructuredText plaintext markup language
>> :keywords: plaintext, markup language
>>
>> How can I use the meta directive with OpenGraph& obtain this output,
>> (with semi-colon in property...):
>>
>> <meta property="og:title" content="The Rock" /> ?
>>
>> Thanks for any help on the subject.
>
> Are you aware of the (currently unmerged) pull request
> https://github.com/sphinx-doc/sphinx/pull/7974 which is supposed to
> add OpenGraph support?

Indeed: that's where I discovered the `sphinxext-opengraph` extension :)

> See also https://github.com/sphinx-doc/sphinx/issues/2645

Provided by `sphinxext-opengraph` I guess.

> and https://github.com/sphinx-doc/sphinx/issues/6089.

No.

Thanks!

Meanwhile, I discovered at least `og:title` is already provided: it is
automatically filled with the first header title of the `.rst` file.

Cheers.
--
Denis
Reply all
Reply to author
Forward
0 new messages