You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Use field lists to implement per page overrides
* Move location where quotes are escaped so that it will work with per page overrides and in general will only happen when it becomes a html tag and starts mattering.
* Add title override
* Add documentation for field lists
* Fix empty field lists from crashing
* Add tests
* Refractor to use fields.get to get the values
* Run black
* Add arbitrary tags support
* Add tests for arbitrary tags
* Add documentation for arbitrary tags
* Prevent creation of multiple tags with the same property
* Revert "Prevent creation of multiple tags with the same property"
This reverts commit 0f3e4a8.
* Rework overrides and arbitrary tags and slightly change syntax
* Update readme.md and adjust image:alt functionality
* Apply suggestions from code review
Co-authored-by: Vasista Vovveti <[email protected]>
* Run black
* Remove any support for relative paths with field lists and add a note
* Revert relative url behaviour
* Change readme to align with previous commit
* Disable relative file paths with field lists
* Fix typo in comments
Co-authored-by: Dalton Smith <[email protected]>
* Update README.md
Co-authored-by: Vasista Vovveti <[email protected]>
Co-authored-by: Dalton Smith <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+47-2
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ Users hosting documentation on Read The Docs *do not* need to set any of the fol
28
28
*`ogp_site_name`
29
29
* This is not required. Name of the site. This is displayed above the title.
30
30
*`ogp_image`
31
-
* This is not required. Link to image to show.
31
+
* This is not required. Link to image to show. Note that all relative paths are converted to be relative to the root of the html output as defined by `ogp_site_name.
32
32
*`ogp_image_alt`
33
33
* This is not required. Alt text for image. Defaults to using `ogp_site_name` or the document's title as alt text, if available. Set to `False` if you want to turn off alt text completely.
34
34
*`ogp_use_first_image`
@@ -37,7 +37,7 @@ Users hosting documentation on Read The Docs *do not* need to set any of the fol
37
37
* This sets the ogp type attribute, for more information on the types available please take a look at https://ogp.me/#types. By default it is set to `website`, which should be fine for most use cases.
38
38
*`ogp_custom_meta_tags`
39
39
* This is not required. List of custom html snippets to insert.
40
-
40
+
41
41
## Example Config
42
42
43
43
### Simple Config
@@ -60,3 +60,48 @@ ogp_custom_meta_tags = [
60
60
]
61
61
62
62
```
63
+
64
+
## Per Page Overrides
65
+
[Field lists](https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html) are used to allow you to override certain settings on each page and set unsupported arbitrary OpenGraph tags.
66
+
67
+
Make sure you place the fields at the very start of the document such that Sphinx will pick them up and also won't build them into the html.
68
+
69
+
### Overrides
70
+
These are some overrides that can be used, you can actually override any tag and field lists will always take priority.
71
+
72
+
*`:og_description_length:`
73
+
* Configure the amount of characters to grab for the description of the page. If the value isn't a number it will fall back to `ogp_description_length`. Note the slightly different syntax because this isn't directly an OpenGraph tag.
74
+
*`:og:description:`
75
+
* Lets you override the description of the page.
76
+
*`:og:title:`
77
+
* Lets you override the title of the page.
78
+
*`:og:type:`
79
+
* Override the type of the page, for the list of available types take a look at https://ogp.me/#types.
80
+
*`:ogp:image:`
81
+
* Set the image for the page.[^1]
82
+
*`:ogp:image:alt:`
83
+
* Sets the alt text. Will be ignored if there is no image set.
84
+
85
+
### Example
86
+
Remember that the fields **must** be placed at the very start of the file. You can verify Sphinx has picked up the fields if they aren't shown in the final html file.
87
+
88
+
```rst
89
+
:og:description: New description
90
+
:og:image: http://example.org/image.png
91
+
:og:image:alt: Example Image
92
+
93
+
Page contents
94
+
=============
95
+
```
96
+
97
+
### Arbitrary Tags[^1]
98
+
Additionally, you can use field lists to add any arbitrary OpenGraph tag not supported by the extension. The syntax for arbitrary tags is the same with `:og:tag: content`. For Example:
99
+
100
+
```rst
101
+
:og:video: http://example.org/video.mp4
102
+
103
+
Page contents
104
+
=============
105
+
```
106
+
107
+
[^1]: Note: Relative file paths for images, videos and audio are currently **not** supported when using field lists. Please use an absolute path instead.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at lorem ornare, fringilla massa nec, venenatis mi. Donec erat sapien, tincidunt nec rhoncus nec, scelerisque id diam. Orci varius natoque penatibus et magnis dis parturient mauris.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at lorem ornare, fringilla massa nec, venenatis mi. Donec erat sapien, tincidunt nec rhoncus nec, scelerisque id diam. Orci varius natoque penatibus et magnis dis parturient mauris.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at lorem ornare, fringilla massa nec, venenatis mi. Donec erat sapien, tincidunt nec rhoncus nec, scelerisque id diam. Orci varius natoque penatibus et magnis dis parturient mauris.
0 commit comments