Skip to content

Commit e425b99

Browse files
committed
Finished rewrite of reference documentation
1 parent b6cd73e commit e425b99

15 files changed

+120
-269
lines changed

docs/reference/code-blocks.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ import tensorflow as tf
110110

111111
Code annotations can be placed anywhere in a code block where a comment for the
112112
language of the block can be placed, e.g. for JavaScript in `#!js // ...` and
113-
`#!js /* ... */`, for Yaml `#!yaml # ...`, etc.[^1]
113+
`#!js /* ... */`, for YAML in `#!yaml # ...`, etc.[^1]
114114

115115
[^1]:
116116
Code annotations require syntax highlighting with [Pygments] – they're
@@ -202,7 +202,7 @@ at `1`, regardless of the starting line number specified as part of
202202
items[j], items[j + 1] = items[j + 1], items[j]
203203
```
204204

205-
=== "Line ranges"
205+
=== "Line number ranges"
206206

207207
_Example_:
208208

docs/reference/meta-tags.md

+49-106
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,60 @@ template: overrides/main.html
66

77
In HTML, `meta` tags allow to provide additional metadata for a document, e.g.
88
page titles and descriptions, additional assets to be loaded, and [Open Graph]
9-
[1] data. While arbitrary metadata can always be added via [customization][2],
9+
metadata. While arbitrary `meta` tags can always be added via [customization],
1010
some common `meta` tags can be configured.
1111

12-
[1]: https://ogp.me/
13-
[2]: #customization
12+
[Open Graph]: https://ogp.me/
13+
[customization]: #customization
1414

1515
## Configuration
1616

17-
### Metadata
18-
19-
The [Metadata][3] extension, which is part of the standard Markdown library,
20-
adds the ability to add [front matter][4] to a document and can be enabled via
21-
`mkdocs.yml`:
17+
This configuration adds support for setting custom page titles and descriptions
18+
in [front matter], as well as for using custom metadata in templates. Add the
19+
following lines to `mkdocs.yml`:
2220

2321
``` yaml
2422
markdown_extensions:
2523
- meta
2624
```
2725
28-
Front matter is written as a series of key-value pairs at the beginning of the
29-
Markdown document, delimited by a blank line which ends the YAML context.
26+
See additional configuration options:
27+
28+
- [Metadata]
3029
31-
[3]: https://python-markdown.github.io/extensions/meta_data/
32-
[4]: https://jekyllrb.com/docs/front-matter/
30+
[front matter]: https://jekyllrb.com/docs/front-matter/
31+
[Metadata]: ../setup/extensions/python-markdown.md#metadata
3332
3433
## Usage
3534
3635
### Setting the page title
3736
38-
If the [Metadata][5] extension is enabled, the page title can be overridden on
39-
a per-document basis with custom front matter:
37+
When [Metadata] is enabled, the page title can be overridden on a per-document
38+
basis with custom front matter. Add the following lines at the top of a Markdown
39+
file:
4040
4141
``` bash
4242
---
43-
title: Lorem ipsum dolor sit amet
43+
title: Lorem ipsum dolor sit amet # (1)
4444
---
4545

4646
# Document title
4747
...
4848
```
4949

50-
This will set the `title` tag inside the document `head` for the current page
51-
to the provided value. Note that the site title is appended using a dash as a
52-
separator, which is the default behavior.
50+
1. This will set the [`title`][title] inside the HTML document's [`head`][head]
51+
for the generated page to this value. Note that the site title, which is set
52+
via [`site_name`][site_name], is appended with a dash.
5353

54-
[5]: #metadata
54+
[title]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
55+
[head]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head
56+
[site_name]: https://www.mkdocs.org/user-guide/configuration/#site_name
5557

5658
### Setting the page description
5759

58-
If the [Metadata][5] extension is enabled, the page description can also be
59-
overridden on a per-document basis with custom front matter:
60+
When [Metadata] is enabled, the page description can also be overridden on a
61+
per-document basis with custom front matter. Add the following lines at the top
62+
of a Markdown file:
6063

6164
``` bash
6265
---
@@ -70,47 +73,41 @@ description: Nullam urna elit, malesuada eget finibus ut, ac tortor.
7073
This will set the `meta` tag containing the site description inside the
7174
document `head` for the current page to the provided value.
7275

76+
<div class="mdx-deprecated" markdown>
77+
7378
### Adding a web app manifest
7479

75-
A [web app manifest][6] is a simple JSON file that specifies how your web
80+
:octicons-archive-24: Deprecated ·
81+
[:octicons-tag-24: 3.1.0 ... present][web app manifest support] ·
82+
:octicons-trash-24: 8.0.0
83+
84+
A [web app manifest] is a simple JSON file that specifies how your web
7685
application should behave when installed on the user's mobile device or desktop,
7786
which can be set via `mkdocs.yml`:
7887

7988
``` yaml
8089
extra:
81-
manifest: manifest.webmanifest
90+
manifest: manifest.webmanifest # (1)
8291
```
8392
84-
[6]: https://developers.google.com/web/fundamentals/web-app-manifest/
93+
1. This option was deprecated, as it's not widely used and the same behavior
94+
can be achieved with [theme extension].
8595
86-
## Customization
87-
88-
### Displaying the metadata
96+
[web app manifest]: https://developers.google.com/web/fundamentals/web-app-manifest/
97+
[web app manifest support]: https://github.com/squidfunk/mkdocs-material/releases/tag/3.1.0
98+
[theme extension]: ../customization.md#extending-the-theme
8999
90-
Sometimes it's useful to be able to display the medatada in the page body, e.g.
91-
print the name of the page author at the bottom of the page. To achieve that,
92-
you can [extend the theme][7] by adding the following contents to `main.html`:
100+
</div>
93101
94-
``` html
95-
{% extends "base.html" %}
96-
97-
{% block content %}
98-
{{ super() }}
99-
{% if page and page.meta and page.meta.author %}
100-
<p><small>Author: {{ page.meta.author }}</small></p>
101-
{% endif %}
102-
{% endblock %}
103-
```
104-
105-
[7]: ../customization.md#extending-the-theme
102+
## Customization
106103
107-
### Custom meta tags
104+
### Using metadata in templates
108105
109106
#### on all pages
110107
111108
In order to add custom `meta` tags to your document, you can [extend the theme
112-
][7] and simply [override the `extrahead` block][8], e.g. to add indexing
113-
policies for search engines:
109+
][theme extension] and [override the `extrahead` block][override block],
110+
e.g. to add indexing policies for search engines via the `robots` property:
114111

115112
``` html
116113
{% extends "base.html" %}
@@ -120,7 +117,7 @@ policies for search engines:
120117
{% endblock %}
121118
```
122119

123-
[8]: ../customization.md#overriding-blocks-recommended
120+
[override block]: ../customization.md#overriding-blocks-recommended
124121

125122
#### on a single page
126123

@@ -140,63 +137,9 @@ template override, e.g.:
140137
{% endblock %}
141138
```
142139

143-
You can now use `robots` exactly like [`title`][9] and [`description`][10] to
144-
set values. Note that in this case, the template defines an `else` branch, which
145-
would set a default if none was given.
146-
147-
[9]: #setting-the-page-title
148-
[10]: #setting-the-page-description
149-
150-
### Social meta tags
151-
152-
Some further examples, including [Open Graph][1] and [Twitter Cards][11]:
153-
154-
=== "Open Graph"
155-
156-
``` html
157-
{% block extrahead %}
158-
{% set title = config.site_name %}
159-
{% if page and page.meta and page.meta.title %}
160-
{% set title = title ~ " - " ~ page.meta.title %}
161-
{% elif page and page.title and not page.is_homepage %}
162-
{% set title = title ~ " - " ~ page.title | striptags %}
163-
{% endif %}
164-
<meta property="og:type" content="website" />
165-
<meta property="og:title" content="{{ title }}" />
166-
<meta property="og:description" content="{{ config.site_description }}" />
167-
<meta property="og:url" content="{{ page.canonical_url }}" />
168-
<meta property="og:image" content="<url>" />
169-
<meta property="og:image:type" content="image/png" />
170-
<meta property="og:image:width" content="1200" />
171-
<meta property="og:image:height" content="630" />
172-
{% endblock %}
173-
```
174-
175-
=== "Twitter Cards"
176-
177-
``` html
178-
{% block extrahead %}
179-
{% set title = config.site_name %}
180-
{% if page and page.meta and page.meta.title %}
181-
{% set title = title ~ " - " ~ page.meta.title %}
182-
{% elif page and page.title and not page.is_homepage %}
183-
{% set title = title ~ " - " ~ page.title | striptags %}
184-
{% endif %}
185-
<meta name="twitter:card" content="summary_large_image" />
186-
<meta name="twitter:site" content="<username>" />
187-
<meta name="twitter:creator" content="<username>" />
188-
<meta name="twitter:title" content="{{ title }}" />
189-
<meta name="twitter:description" content="{{ config.site_description }}" />
190-
<meta name="twitter:image" content="<url>" />
191-
{% endblock %}
192-
```
193-
194-
!!! tip "Automatically generated social cards"
195-
196-
If you don't want to bother with meta tags and social cards yourself, you
197-
can let the [built-in social cards plugin][12] do the work for you, which
198-
generates beautiful image previews for social media automatically during
199-
the build.
200-
201-
[11]: https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards
202-
[12]: ../setup/setting-up-social-cards.md
140+
You can now use `robots` exactly like [`title`][title] and
141+
[`description`][description] to set values. Note that in this case, the
142+
template defines an `else` branch, which would set a default if none was given.
143+
144+
[title]: #setting-the-page-title
145+
[description]: #setting-the-page-description

docs/reference/variables.md

-152
This file was deleted.

0 commit comments

Comments
 (0)