mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-06-04 22:42:33 -04:00
Added Open Graph and Twitter cards documentation
This commit is contained in:
@@ -34,6 +34,23 @@ This will insert a comment system on _every page, except the index page_.
|
||||
[3]: https://www.mkdocs.org/user-guide/configuration/#site_url
|
||||
[4]: https://help.disqus.com/en/articles/1717111-what-s-a-shortname
|
||||
|
||||
### Metadata
|
||||
|
||||
The [Metadata][5] extension, which is part of the standard Markdown library,
|
||||
adds the ability to add [front matter][6] to a document and can be enabled via
|
||||
`mkdocs.yml`:
|
||||
|
||||
``` yaml
|
||||
markdown_extensions:
|
||||
- meta
|
||||
```
|
||||
|
||||
Front matter is written as a series of key-value pairs at the beginning of the
|
||||
Markdown document, delimited by a blank line which ends the YAML context.
|
||||
|
||||
[5]: https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html
|
||||
[6]: https://jekyllrb.com/docs/front-matter/
|
||||
|
||||
## Customization
|
||||
|
||||
### Selective integration
|
||||
@@ -41,7 +58,7 @@ This will insert a comment system on _every page, except the index page_.
|
||||
[:octicons-file-code-24: Source][2] ·
|
||||
:octicons-mortar-board-24: Difficulty: _easy_
|
||||
|
||||
If the [Metadata][5] extension is enabled, you can disable or enable Disqus for
|
||||
If the [Metadata][7] extension is enabled, you can disable or enable Disqus for
|
||||
specific pages by adding the following to the front matter of a page:
|
||||
|
||||
=== "Enable Disqus"
|
||||
@@ -60,4 +77,4 @@ specific pages by adding the following to the front matter of a page:
|
||||
---
|
||||
```
|
||||
|
||||
[5]: ../reference/meta-tags.md#metadata
|
||||
[7]: #metadata
|
||||
|
||||
@@ -230,6 +230,16 @@ in the [color schemes][10] section:
|
||||
--md-primary-fg-color--light: #ECB7B7;
|
||||
--md-primary-fg-color--dark: #90030C;
|
||||
}
|
||||
```
|
||||
|
||||
Additionally, the `slate` color scheme defines all of it's colors via `hsla`
|
||||
color functions and deduces its colors from the `--md-hue` CSS variable. You
|
||||
can tune the `slate` theme with:
|
||||
|
||||
``` css
|
||||
[data-md-color-scheme="slate"] {
|
||||
--md-hue: 210; /* [0, 360] */
|
||||
}
|
||||
```
|
||||
|
||||
[9]: https://www.w3.org/TR/selectors-4/#attribute-selectors
|
||||
|
||||
@@ -142,7 +142,7 @@ want to change in the [base translation][1] and add it to the partial.
|
||||
|
||||
Let's say you want to change "__Table of contents__" to "__On this page__":
|
||||
|
||||
``` jinja
|
||||
``` html
|
||||
{% macro t(key) %}{{ {
|
||||
"toc.title": "On this page"
|
||||
}[key] }}{% endmacro %}
|
||||
|
||||
@@ -54,9 +54,9 @@ In order to integrate another analytics service provider offering an
|
||||
asynchronous JavaScript-based tracking solution, you can [extend the theme][5]
|
||||
and [override the `analytics` block][6]:
|
||||
|
||||
``` jinja
|
||||
``` html
|
||||
{% block analytics %}
|
||||
{# Add custom analytics integration here #}
|
||||
<!-- Add custom analytics integration here -->
|
||||
{% endblock %}
|
||||
```
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ template, both of which don't transform the query prior to submission, or
|
||||
customize the `transform` function, you can do this by [overriding the
|
||||
`config` block][14]:
|
||||
|
||||
``` jinja
|
||||
``` html
|
||||
{% block config %}
|
||||
<script>
|
||||
var search = {
|
||||
@@ -241,7 +241,7 @@ want to switch the web worker with your own implementation, e.g. to submit
|
||||
search to an external service, you can add a custom JavaScript file to the `docs`
|
||||
directory and [override the `config` block][14]:
|
||||
|
||||
``` jinja
|
||||
``` html
|
||||
{% block config %}
|
||||
<script>
|
||||
var search = {
|
||||
|
||||
Reference in New Issue
Block a user