1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-09-24 19:38:27 +02:00

Documentation

This commit is contained in:
squidfunk 2023-07-07 11:55:18 +02:00
parent ab394910e3
commit 0bfa83c452
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF

View File

@ -1005,6 +1005,49 @@ This will add two circles to the background:
![Layer icon circles] ![Layer icon circles]
### Tags
The new [built-in social plugin] gives full flexibility of the meta tags that
are added to your site, which are necessary to instruct services like Twitter
or Discord how to display your social card. All default layouts use the following
set of tags, which you can copy to your layout and adapt:
``` yaml
definitions:
- &page_title_with_site_name >-
{%- if not page.is_homepage -%}
{{ page.meta.get("title", page.title) }} - {{ config.site_name }}
{%- else -%}
{{ page.meta.get("title", page.title) }}
{%- endif -%}
- &page_description >-
{{ page.meta.get("description", config.site_description) or "" }}
tags:
og:type: website
og:title: *page_title_with_site_name
og:description: *page_description
og:image: "{{ image.url }}"
og:image:type: "{{ image.type }}"
og:image:width: "{{ image.width }}"
og:image:height: "{{ image.height }}"
og:url: "{{ page.canonical_url }}"
twitter:card: summary_large_image
twitter.title: *page_title_with_site_name
twitter:description: *page_description
twitter:image: "{{ image.url }}"
```
Note that this examples makes use of [YAML anchors] to minify repetition. The
`definitions` property is solely intended for the definition on aliases that
can then be referenced with anchors.
[YAML anchors]: https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/
__Are you missing something? Please [open a discussion] and let us know!__ __Are you missing something? Please [open a discussion] and let us know!__
[additional icons]: ./changing-the-logo-and-icons.md#additional-icons [additional icons]: ./changing-the-logo-and-icons.md#additional-icons