Skip to content

Commit 6be485c

Browse files
committed
Documentation
1 parent 28ebcbf commit 6be485c

File tree

5 files changed

+205
-80
lines changed

5 files changed

+205
-80
lines changed

docs/plugins/blog.md

Lines changed: 195 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,8 @@ The provided path is resolved from the [`docs` directory][mkdocs.docs_dir].
213213
<!-- md:default `false` -->
214214

215215
Use this setting to leverage the table of contents to display post titles in
216-
views. The value of this setting is inherited by [`archive_toc`]
217-
[config.archive_toc] and [`categories_toc`][config.categories_toc],
218-
unless they are explicitly set:
216+
views. This might be useful, if your post excerpts are rather long. If you want
217+
to enable it, use:
219218

220219
``` yaml
221220
plugins:
@@ -746,7 +745,7 @@ plugins:
746745

747746
Use this setting to change the number of posts rendered per archive page. The
748747
value of this setting is inherited from [`pagination_per_page`]
749-
[config.pagination_per_page], unless it's explicitly set:
748+
[config.pagination_per_page], unless it's explicitly set. To change it, use:
750749

751750
``` yaml
752751
plugins:
@@ -763,7 +762,7 @@ plugins:
763762

764763
Use this setting to leverage the table of contents to display post titles on all
765764
archive pages. The value of this setting is inherited from [`blog_toc`]
766-
[config.blog_toc], unless it's explicitly set:
765+
[config.blog_toc], unless it's explicitly set. To change it, use
767766

768767
``` yaml
769768
plugins:
@@ -971,7 +970,7 @@ plugins:
971970

972971
Use this setting to change the number of posts rendered per category page. The
973972
value of this setting is inherited from [`pagination_per_page`]
974-
[config.pagination_per_page], unless it's explicitly set:
973+
[config.pagination_per_page], unless it's explicitly set. To change it, use:
975974

976975
``` yaml
977976
plugins:
@@ -988,14 +987,203 @@ plugins:
988987

989988
Use this setting to leverage the table of contents to display post titles on all
990989
category pages. The value of this setting is inherited from [`blog_toc`]
991-
[config.blog_toc], unless it's explicitly set:
990+
[config.blog_toc], unless it's explicitly set. To change it, use:
992991

993992
``` yaml
994993
plugins:
995994
- blog:
996995
categories_toc: true
997996
```
998997

998+
### Authors
999+
1000+
The following settings are available for authors:
1001+
1002+
---
1003+
1004+
#### <!-- md:setting config.authors -->
1005+
1006+
<!-- md:version 9.2.0 -->
1007+
<!-- md:default `true` -->
1008+
1009+
Use this setting to enable or disable post authors. If this setting is enabled,
1010+
the plugin will look for a file named [`.authors.yml`][config.authors_file] and
1011+
render authors in posts and views. Disable this behavior with:
1012+
1013+
``` yaml
1014+
plugins:
1015+
- blog:
1016+
authors: false
1017+
```
1018+
1019+
---
1020+
1021+
#### <!-- md:setting config.authors_file -->
1022+
1023+
<!-- md:version 9.2.0 -->
1024+
<!-- md:default `{blog}/.authors.yml` -->
1025+
1026+
Use this setting to change the path of the file where the author information for
1027+
your posts resides. It's normally not necessary to change this setting, but if
1028+
you need to, use:
1029+
1030+
``` yaml
1031+
plugins:
1032+
- blog:
1033+
authors_file: "{blog}/.authors.yml"
1034+
```
1035+
1036+
The following placeholders are available:
1037+
1038+
- `blog` – [`blog` directory][config.blog_dir]
1039+
1040+
The provided path is resolved from the [`docs` directory][mkdocs.docs_dir].
1041+
1042+
!!! info "Format of author information"
1043+
1044+
The `.authors.yml` file must adhere to the following format:
1045+
1046+
``` yaml title=".authors.yml"
1047+
authors:
1048+
<author>:
1049+
name: string # Author name
1050+
description: string # Author description
1051+
avatar: url # Author avatar
1052+
slug: url # Author profile slug
1053+
url: url # Author website URL
1054+
```
1055+
1056+
Note that `<author>` must be set to an identifier for associating authors
1057+
with posts, e.g., a GitHub username like `squidfunk`. This identifier can
1058+
then be used in the [`authors`][meta.authors] metadata property of
1059+
a post. Multiple authors are supported. As an example, see
1060+
[the `.authors.yml` file][.authors.yml] we're using for our blog.
1061+
1062+
[.authors.yml]: https://github.com/squidfunk/mkdocs-material/blob/master/docs/blog/.authors.yml
1063+
1064+
---
1065+
1066+
#### <!-- md:setting config.authors_profiles -->
1067+
1068+
<!-- md:sponsors -->
1069+
<!-- md:version insiders-4.46.0 -->
1070+
<!-- md:default `false` -->
1071+
1072+
Use this setting to enable or disable automatically generated author profiles.
1073+
An author profile shows all posts by an author in reverse chronological order.
1074+
You can enable author profiles with:
1075+
1076+
``` yaml
1077+
plugins:
1078+
- blog:
1079+
author_profiles: true
1080+
```
1081+
1082+
---
1083+
1084+
#### <!-- md:setting config.authors_profiles_name -->
1085+
1086+
<!-- md:sponsors -->
1087+
<!-- md:version insiders-4.46.0 -->
1088+
<!-- md:default computed -->
1089+
1090+
Use this setting to change the title of the authors section the plugin adds to
1091+
the navigation. If this setting is omitted, it's sourced from the translations.
1092+
If you want to change it, use:
1093+
1094+
``` yaml
1095+
plugins:
1096+
- blog:
1097+
authors_profiles_name: Authors
1098+
```
1099+
1100+
---
1101+
1102+
#### <!-- md:setting config.authors_profiles_url_format -->
1103+
1104+
<!-- md:sponsors -->
1105+
<!-- md:version insiders-4.46.0 -->
1106+
<!-- md:default `author/{slug}` -->
1107+
1108+
Use this setting to change the format string that is used when generating
1109+
author profile URLs. You can freely combine placeholders, and join them with
1110+
slashes or other characters:
1111+
1112+
=== ":material-link: blog/author/:material-dots-horizontal:/"
1113+
1114+
``` yaml
1115+
plugins:
1116+
- blog:
1117+
authors_profiles_url_format: "author/{slug}"
1118+
```
1119+
1120+
=== ":material-link: blog/:material-dots-horizontal:/"
1121+
1122+
``` yaml
1123+
plugins:
1124+
- blog:
1125+
authors_profiles_url_format: "{slug}"
1126+
```
1127+
1128+
The following placeholders are available:
1129+
1130+
- `slug` – Author slug or identifier from [`authors_file`][config.authors_file]
1131+
- `name` – Author name from [`authors_file`][config.authors_file]
1132+
1133+
---
1134+
1135+
#### <!-- md:setting config.authors_profiles_pagination -->
1136+
1137+
<!-- md:sponsors -->
1138+
<!-- md:version insiders-4.46.0 -->
1139+
<!-- md:default `true` -->
1140+
1141+
Use this setting to enable or disable pagination for author profiles. The value
1142+
of this setting is inherited from [`pagination`][config.pagination], unless it's
1143+
explicitly set. To disable pagination, use:
1144+
1145+
``` yaml
1146+
plugins:
1147+
- blog:
1148+
authors_profiles_pagination: false
1149+
```
1150+
1151+
---
1152+
1153+
#### <!-- md:setting config.authors_profiles_pagination_per_page -->
1154+
1155+
<!-- md:sponsors -->
1156+
<!-- md:version insiders-4.46.0 -->
1157+
<!-- md:default `10` -->
1158+
1159+
Use this setting to change the number of posts rendered per archive page. The
1160+
value of this setting is inherited from [`pagination_per_page`]
1161+
[config.pagination_per_page], unless it's explicitly set. To change it, use:
1162+
1163+
``` yaml
1164+
plugins:
1165+
- blog:
1166+
authors_profiles_pagination_per_page: 5
1167+
```
1168+
1169+
---
1170+
1171+
#### <!-- md:setting config.authors_profiles_toc -->
1172+
1173+
<!-- md:sponsors -->
1174+
<!-- md:version insiders-4.46.0 -->
1175+
<!-- md:default `false` -->
1176+
1177+
Use this setting to leverage the table of contents to display post titles on all
1178+
author profiles. The value of this setting is inherited from [`blog_toc`]
1179+
[config.blog_toc], unless it's explicitly set. To change it, use:
1180+
1181+
``` yaml
1182+
plugins:
1183+
- blog:
1184+
authors_profiles_toc: true
1185+
```
1186+
9991187
### Pagination
10001188

10011189
The following settings are available for pagination:
@@ -1151,71 +1339,6 @@ plugins:
11511339
pagination_keep_content: true
11521340
```
11531341

1154-
### Authors
1155-
1156-
The following settings are available for authors:
1157-
1158-
---
1159-
1160-
#### <!-- md:setting config.authors -->
1161-
1162-
<!-- md:version 9.2.0 -->
1163-
<!-- md:default `true` -->
1164-
1165-
Use this setting to enable or disable post authors. If this setting is enabled,
1166-
the plugin will look for a file named [`.authors.yml`][config.authors_file] and
1167-
render authors in posts and views. Disable this behavior with:
1168-
1169-
``` yaml
1170-
plugins:
1171-
- blog:
1172-
authors: false
1173-
```
1174-
1175-
---
1176-
1177-
#### <!-- md:setting config.authors_file -->
1178-
1179-
<!-- md:version 9.2.0 -->
1180-
<!-- md:default `{blog}/.authors.yml` -->
1181-
1182-
Use this setting to change the path of the file where the author information for
1183-
your posts resides. It's normally not necessary to change this setting, but if
1184-
you need to, use:
1185-
1186-
``` yaml
1187-
plugins:
1188-
- blog:
1189-
authors_file: "{blog}/.authors.yml"
1190-
```
1191-
1192-
The following placeholders are available:
1193-
1194-
- `blog` – [`blog` directory][config.blog_dir]
1195-
1196-
The provided path is resolved from the [`docs` directory][mkdocs.docs_dir].
1197-
1198-
!!! info "Format of author information"
1199-
1200-
The `.authors.yml` file must adhere to the following format:
1201-
1202-
``` yaml title=".authors.yml"
1203-
authors:
1204-
<author>:
1205-
name: string # Author name
1206-
description: string # Author description
1207-
avatar: url # Author avatar
1208-
url: url # Author website URL
1209-
```
1210-
1211-
Note that `<author>` must be set to an identifier for associating authors
1212-
with posts, e.g., a GitHub username like `squidfunk`. This identifier can
1213-
then be used in the [`authors`][meta.authors] metadata property of
1214-
a post. Multiple authors are supported. As an example, see
1215-
[the `.authors.yml` file][.authors.yml] we're using for our blog.
1216-
1217-
[.authors.yml]: https://github.com/squidfunk/mkdocs-material/blob/master/docs/blog/.authors.yml
1218-
12191342
### Drafts
12201343

12211344
The following settings are available for drafts:

material/plugins/blog/author.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Author(Config):
3030
name = Type(str)
3131
description = Type(str)
3232
avatar = Type(str)
33+
slug = Optional(Type(str))
3334
url = Optional(Type(str))
3435

3536
# -----------------------------------------------------------------------------

material/plugins/blog/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ class BlogConfig(Config):
6767
categories_allowed = Type(list, default = [])
6868
categories_toc = Optional(Type(bool))
6969

70+
# Settings for authors
71+
authors = Type(bool, default = True)
72+
authors_file = Type(str, default = "{blog}/.authors.yml")
73+
7074
# Settings for pagination
7175
pagination = Type(bool, default = True)
7276
pagination_per_page = Type(int, default = 10)
@@ -75,10 +79,6 @@ class BlogConfig(Config):
7579
pagination_if_single_page = Type(bool, default = False)
7680
pagination_keep_content = Type(bool, default = False)
7781

78-
# Settings for authors
79-
authors = Type(bool, default = True)
80-
authors_file = Type(str, default = "{blog}/.authors.yml")
81-
8282
# Settings for drafts
8383
draft = Type(bool, default = False)
8484
draft_on_serve = Type(bool, default = True)

src/plugins/blog/author.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Author(Config):
3030
name = Type(str)
3131
description = Type(str)
3232
avatar = Type(str)
33+
slug = Optional(Type(str))
3334
url = Optional(Type(str))
3435

3536
# -----------------------------------------------------------------------------

src/plugins/blog/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ class BlogConfig(Config):
6767
categories_allowed = Type(list, default = [])
6868
categories_toc = Optional(Type(bool))
6969

70+
# Settings for authors
71+
authors = Type(bool, default = True)
72+
authors_file = Type(str, default = "{blog}/.authors.yml")
73+
7074
# Settings for pagination
7175
pagination = Type(bool, default = True)
7276
pagination_per_page = Type(int, default = 10)
@@ -75,10 +79,6 @@ class BlogConfig(Config):
7579
pagination_if_single_page = Type(bool, default = False)
7680
pagination_keep_content = Type(bool, default = False)
7781

78-
# Settings for authors
79-
authors = Type(bool, default = True)
80-
authors_file = Type(str, default = "{blog}/.authors.yml")
81-
8282
# Settings for drafts
8383
draft = Type(bool, default = False)
8484
draft_on_serve = Type(bool, default = True)

0 commit comments

Comments
 (0)