mkdocs-document-dates 3.2__tar.gz → 3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. mkdocs_document_dates-3.3/LICENSE +22 -0
  2. {mkdocs_document_dates-3.2/mkdocs_document_dates.egg-info → mkdocs_document_dates-3.3}/PKG-INFO +77 -62
  3. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/README.md +75 -60
  4. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/cache_manager.py +3 -7
  5. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/plugin.py +209 -112
  6. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/config/user.config.css +26 -6
  7. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/config/user.config.js +14 -6
  8. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/core/core.css +69 -14
  9. mkdocs_document_dates-3.3/mkdocs_document_dates/static/core/core.js +210 -0
  10. mkdocs_document_dates-3.3/mkdocs_document_dates/static/core/timeago-load.js +18 -0
  11. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/utils.py +45 -70
  12. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3/mkdocs_document_dates.egg-info}/PKG-INFO +77 -62
  13. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/setup.py +3 -3
  14. mkdocs_document_dates-3.2/LICENSE +0 -11
  15. mkdocs_document_dates-3.2/mkdocs_document_dates/static/core/core.js +0 -114
  16. mkdocs_document_dates-3.2/mkdocs_document_dates/static/core/timeago-load.js +0 -5
  17. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/MANIFEST.in +0 -0
  18. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/__init__.py +0 -0
  19. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/hooks/pre-commit +0 -0
  20. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/hooks_installer.py +0 -0
  21. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/core/timeago.full.min.js +0 -0
  22. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/core/timeago.min.js +0 -0
  23. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/languages/ar.json +0 -0
  24. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/languages/de.json +0 -0
  25. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/languages/en.json +0 -0
  26. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/languages/es.json +0 -0
  27. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/languages/fr.json +0 -0
  28. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/languages/ja.json +0 -0
  29. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/languages/ko.json +0 -0
  30. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/languages/ru.json +0 -0
  31. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/languages/zh.json +0 -0
  32. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/languages/zh_TW.json +0 -0
  33. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/tippy/backdrop.css +0 -0
  34. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/tippy/light.css +0 -0
  35. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/tippy/material.css +0 -0
  36. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/tippy/popper.min.js +0 -0
  37. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/tippy/scale.css +0 -0
  38. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/tippy/shift-away.css +0 -0
  39. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/tippy/tippy.css +0 -0
  40. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates/static/tippy/tippy.umd.min.js +0 -0
  41. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
  42. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
  43. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
  44. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates.egg-info/requires.txt +0 -0
  45. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
  46. {mkdocs_document_dates-3.2 → mkdocs_document_dates-3.3}/setup.cfg +0 -0
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Aaron Wang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-document-dates
3
- Version: 3.2
4
- Summary: An easy-to-use, lightweight MkDocs plugin for displaying the exact creation time, last modification time and author info of markdown documents.
3
+ Version: 3.3
4
+ Summary: A new generation MkDocs plugin for displaying exact meta-info, such as creation time, last update time, authors, email, etc
5
5
  Home-page: https://github.com/jaywhj/mkdocs-document-dates
6
6
  Author: Aaron Wang
7
7
  Author-email: aaronwqt@gmail.com
@@ -30,7 +30,7 @@ English | [简体中文](README_zh.md)
30
30
 
31
31
 
32
32
 
33
- An easy-to-use, lightweight MkDocs plugin for displaying the <mark>exact</mark> creation time, last modification time and author info of markdown documents.
33
+ A new generation MkDocs plugin for displaying exact meta-info of documents, such as **creation time, last update time, authors, email**, etc
34
34
 
35
35
  ## Features
36
36
 
@@ -40,9 +40,16 @@ An easy-to-use, lightweight MkDocs plugin for displaying the <mark>exact</mark>
40
40
  - Flexible display position (top or bottom)
41
41
  - Elegant styling (fully customizable)
42
42
  - Supports Tooltip Hover Tips
43
- - Intelligent repositioning to always float optimally in view
43
+ - Intelligent dynamic positioning, always floating optimally in view
44
44
  - Supports automatic theme switching following Material's light/dark color scheme
45
45
  - Multi-language support, cross-platform support (Windows, macOS, Linux)
46
+ - **Ultimate build efficiency**: O(1), typically less than 0.2 seconds
47
+
48
+ | PK of Build Efficiency: | 100 md: | 1000 md: | Time Complexity: |
49
+ | --------------------------- | :-----: | :------: | :----------: |
50
+ | git-revision-date-localized | > 3 s | > 30 s | O(n) |
51
+ | document-dates | < 0.1 s | < 0.15 s | O(1) |
52
+
46
53
 
47
54
  ## Showcases
48
55
 
@@ -68,56 +75,82 @@ Or, personalize the configuration:
68
75
  ```yaml
69
76
  plugins:
70
77
  - document-dates:
71
- position: top # Display position: top (after title) bottom (end of document), default: bottom
78
+ position: top # Display position: top (after title) bottom (end of document)
72
79
  type: date # Date type: date datetime timeago, default: date
80
+ exclude: # List of excluded files
81
+ - temp.md # Exclude specific file
82
+ - drafts/* # Exclude all files in drafts folder, including subfolders
73
83
  locale: en # Localization: en zh zh_TW es fr de ar ja ko ru, default: en
74
84
  date_format: '%Y-%m-%d' # Date format strings, e.g., %Y-%m-%d, %b %d, %Y, etc
75
85
  time_format: '%H:%M:%S' # Time format strings (valid only if type=datetime)
76
- exclude: # List of excluded files
77
- - temp.md # Exclude specific file
78
- - private/* # Exclude all files in private directory, including subdirectories
79
86
  show_author: true # Show author or not, default: true
80
87
  ```
81
88
 
82
89
  ## Specify time manually
83
90
 
84
- The plugin will automatically get the exact time of the document, will automatically cache the creation time, but of course, you can also specify it manually in `Front Matter`
85
-
86
- Priority order: `Front Matter` > `Cache Files` > `File System Timestamps`
87
-
88
- ```yaml
89
- ---
90
- created: 2023-01-01
91
- modified: 2025-02-23
92
- ---
93
-
94
- # Document Title
95
- ```
91
+ By default, the plugin will **automatically** get the exact time of the document, and will automatically cache the creation time, without manual intervention
96
92
 
93
+ - **Priority**: `Front Matter` > `File System Timestamps(Cached)` > `Git Timestamps`
94
+ - If you want to customize it, you can specify it manually in Front Matter:
95
+ ```markdown
96
+ ---
97
+ created: 2023-01-01
98
+ modified: 2025-02-23
99
+ ---
100
+
101
+ ```
97
102
  - `created` can be replaced with: `created, date, creation`
98
103
  - `modified` can be replaced with: `modified, updated, last_modified, last_updated`
99
104
 
100
- ## Specify author manually
101
-
102
- The plugin will automatically get the author of the document, will parse the email and make a link, also you can specify it manually in `Front Matter`
105
+ ## Configure Author
103
106
 
104
- Priority order: `Front Matter` > `Git Author` > `site_author (mkdocs.yml)` > `PC Username`
107
+ By default, the plugin will **automatically** get the author of the document, and will automatically parse the email and then do the link, without manual intervention
105
108
 
106
- ```yaml
107
- ---
108
- author: any-name
109
- email: e-name@gmail.com
110
- ---
111
-
112
- # Document Title
113
- ```
109
+ - **Priority**: `Front Matter` > `Git Author` > `site_author(mkdocs.yml)` > `PC Username`
110
+ - If you want to customize it, you can configure an author in Front Matter with the field `name`:
111
+ ```markdown
112
+ ---
113
+ name: any-name
114
+ email: e-name@gmail.com
115
+ ---
116
+
117
+ ```
114
118
 
115
- - `author` can be replaced with: `author, name`
116
- - `email` can be replaced with: `email, mail`
119
+ ## Configure Avatar
120
+
121
+ By default, the plugin will **automatically** loads the author avatar, without manual intervention
122
+
123
+ **Priority**: `Custom Avatar` > `GitHub Avatar` > `Character Avatar`
124
+
125
+ 1. Character avatar: will be automatically generated based on the author's name with the following rules
126
+ - Extract initials: English takes the combination of initials, other languages take the first character
127
+ - Dynamic background color: Generate HSL color based on the hash of the name
128
+ 2. GitHub avatar: will be automatically loaded by parsing the `repo_url` property in mkdocs.yml
129
+ 3. Custom avatar: can be customized by customizing the author's `avatar` field in Front Matter
130
+ ```markdown
131
+ ---
132
+ # Way 1: Configure a full author
133
+ author:
134
+ name: jay
135
+ email: jay@qq.com
136
+ avatar: https://xxx.author-avatar-URL.com/xxx.png
137
+ url: https://xxx.website-URL.com/xxx
138
+ description: author description
139
+
140
+ # Way 2: Configure multiple authors
141
+ authors:
142
+ - jaywhj
143
+ - squidfunk
144
+ - sunny
145
+
146
+ ---
147
+ ```
148
+ - If you want to configure complete information for multiple authors, you can create a separate configuration file `.authors.yml` in the `docs/` or `docs/blog/` directory, see the [.authors.yml](https://github.com/jaywhj/mkdocs-document-dates/blob/main/templates/.authors.yml) for its format
149
+ - If the URL avatar fails to load, it falls back to the character avatar
117
150
 
118
151
  ## Customization
119
152
 
120
- The plugin supports deep customization, such as **icon style, theme color, font, animation, dividing line**, etc. Everything is customizable (I've already written the code, you just need to turn on the uncomment switch):
153
+ The plugin supports deep customization, such as **icon style, theme color, font, animation, dividing line**, etc. Everything is customizable (Find the file below and turn on the uncomment switch):
121
154
 
122
155
  | Category: | Location: |
123
156
  | :----------------------: | ---------------------------------------- |
@@ -135,42 +168,22 @@ The plugin supports deep customization, such as **icon style, theme color, font,
135
168
  - assets/document_dates/core/timeago-load.js
136
169
  ```
137
170
 
138
- **Demo Images**:
139
-
140
- ![01-default-w](mkdocs_document_dates/demo_images/01-default-w.png)
141
- ![02-change-icon](mkdocs_document_dates/demo_images/02-change-icon.png)
142
- ![02-change-icon-color](mkdocs_document_dates/demo_images/02-change-icon-color.png)
143
- ![04-default-pop-up](mkdocs_document_dates/demo_images/04-default-pop-up.png)
144
- ![05-change-theme](mkdocs_document_dates/demo_images/05-change-theme.png)
171
+ ![customization](customization.gif)
145
172
 
146
- ![06-change-theme](mkdocs_document_dates/demo_images/06-change-theme.png)
147
- ![08-pop-up-from-bottom](mkdocs_document_dates/demo_images/08-pop-up-from-bottom.png)
148
-
149
- ## Used in templates
173
+ ## Template Variables
150
174
 
151
175
  You can access the meta-info of a document in a template using the following variables:
152
176
 
153
177
  - page.meta.document_dates_created
154
178
  - page.meta.document_dates_modified
155
179
  - page.meta.document_dates_authors
180
+ - page.meta.document_dates_locale
181
+ - page.meta.document_dates_translation
156
182
 
157
- For example like this:
158
-
159
- ```jinja2
160
- <div><span>{{ page.meta.document_dates_created }}</span></div>
161
- <div><span>{{ page.meta.document_dates_modified }}</span></div>
162
- {% set authors = page.meta.document_dates_authors %}
163
- {% if authors %}
164
- <div>
165
- {% for author in authors %}
166
- {% if author.email %}<a href="mailto:{{ author.email }}">{{ author.name }}</a>
167
- {% else %}<span>{{ author.name }}</span>{% endif %}
168
- {% endfor %}
169
- </div>
170
- {% endif %}
171
- ```
183
+ Usage examples:
172
184
 
173
- **Full example**: set the correct lastmod for [sitemap.xml](https://github.com/jaywhj/mkdocs-document-dates/blob/main/sitemap.xml) so that search engines can better handle SEO and thus increase your site's exposure (override path: `docs/overrides/sitemap.xml`)
185
+ - **Example 1**: Set the correct `lastmod` for your site's `sitemap.xml` so that search engines can better handle SEO and thus increase your site's exposure (download [sitemap.xml](https://github.com/jaywhj/mkdocs-document-dates/blob/main/templates/overrides/sitemap.xml) and override this path: `docs/overrides/sitemap.xml`)
186
+ - **Example 2**: Using the template to re-customize the plugin, you have full control over the rendering logic and the plugin is only responsible for providing the data (download [source-file.html](https://github.com/jaywhj/mkdocs-document-dates/blob/main/templates/overrides/partials/source-file.html) and override this path: `docs/overrides/partials/source-file.html`)
174
187
 
175
188
  ## Other Tips
176
189
 
@@ -200,6 +213,8 @@ A dispensable, insignificant little plug-in, friends who have time can take a lo
200
213
  - Solution: I considered using a shell script, but since I'd have to call back to python eventually, it's easier to use a python script. We can detect the user's python environment when the hook is installed, and then dynamically set the hook's shebang line to set the correct python interpreter
201
214
  4. How can I ensure that a single cache file does not conflict when collaborating with multi-person?
202
215
  - Workaround: use JSONL (JSON Lines) instead of JSON, and with the merge strategy 'merge=union'
216
+ 5. How to reduce build time when there are a lot of documents ( >1000 )? Getting git information about a document is usually a file I/O operation, and if there are a lot of files, the efficiency of the operation will plummet. 1,000 documents can be expected to take more than 30 seconds, which is intolerable to the user
217
+ - Solution: Reduce the number of I/Os + Use caching + Replace less efficient system functions
203
218
  - **Improve**:
204
219
  - Since it's a newly developed plugin, it will be designed in the direction of **excellent products**, and the pursuit of the ultimate **ease of use, simplicity and personalization**
205
220
  - **Ease of use**: don't let users do things manually if you can, e.g., auto-install Git Hooks, auto-cache, auto-commit, provide customized templates, etc
@@ -4,7 +4,7 @@ English | [简体中文](README_zh.md)
4
4
 
5
5
 
6
6
 
7
- An easy-to-use, lightweight MkDocs plugin for displaying the <mark>exact</mark> creation time, last modification time and author info of markdown documents.
7
+ A new generation MkDocs plugin for displaying exact meta-info of documents, such as **creation time, last update time, authors, email**, etc
8
8
 
9
9
  ## Features
10
10
 
@@ -14,9 +14,16 @@ An easy-to-use, lightweight MkDocs plugin for displaying the <mark>exact</mark>
14
14
  - Flexible display position (top or bottom)
15
15
  - Elegant styling (fully customizable)
16
16
  - Supports Tooltip Hover Tips
17
- - Intelligent repositioning to always float optimally in view
17
+ - Intelligent dynamic positioning, always floating optimally in view
18
18
  - Supports automatic theme switching following Material's light/dark color scheme
19
19
  - Multi-language support, cross-platform support (Windows, macOS, Linux)
20
+ - **Ultimate build efficiency**: O(1), typically less than 0.2 seconds
21
+
22
+ | PK of Build Efficiency: | 100 md: | 1000 md: | Time Complexity: |
23
+ | --------------------------- | :-----: | :------: | :----------: |
24
+ | git-revision-date-localized | > 3 s | > 30 s | O(n) |
25
+ | document-dates | < 0.1 s | < 0.15 s | O(1) |
26
+
20
27
 
21
28
  ## Showcases
22
29
 
@@ -42,56 +49,82 @@ Or, personalize the configuration:
42
49
  ```yaml
43
50
  plugins:
44
51
  - document-dates:
45
- position: top # Display position: top (after title) bottom (end of document), default: bottom
52
+ position: top # Display position: top (after title) bottom (end of document)
46
53
  type: date # Date type: date datetime timeago, default: date
54
+ exclude: # List of excluded files
55
+ - temp.md # Exclude specific file
56
+ - drafts/* # Exclude all files in drafts folder, including subfolders
47
57
  locale: en # Localization: en zh zh_TW es fr de ar ja ko ru, default: en
48
58
  date_format: '%Y-%m-%d' # Date format strings, e.g., %Y-%m-%d, %b %d, %Y, etc
49
59
  time_format: '%H:%M:%S' # Time format strings (valid only if type=datetime)
50
- exclude: # List of excluded files
51
- - temp.md # Exclude specific file
52
- - private/* # Exclude all files in private directory, including subdirectories
53
60
  show_author: true # Show author or not, default: true
54
61
  ```
55
62
 
56
63
  ## Specify time manually
57
64
 
58
- The plugin will automatically get the exact time of the document, will automatically cache the creation time, but of course, you can also specify it manually in `Front Matter`
59
-
60
- Priority order: `Front Matter` > `Cache Files` > `File System Timestamps`
61
-
62
- ```yaml
63
- ---
64
- created: 2023-01-01
65
- modified: 2025-02-23
66
- ---
67
-
68
- # Document Title
69
- ```
65
+ By default, the plugin will **automatically** get the exact time of the document, and will automatically cache the creation time, without manual intervention
70
66
 
67
+ - **Priority**: `Front Matter` > `File System Timestamps(Cached)` > `Git Timestamps`
68
+ - If you want to customize it, you can specify it manually in Front Matter:
69
+ ```markdown
70
+ ---
71
+ created: 2023-01-01
72
+ modified: 2025-02-23
73
+ ---
74
+
75
+ ```
71
76
  - `created` can be replaced with: `created, date, creation`
72
77
  - `modified` can be replaced with: `modified, updated, last_modified, last_updated`
73
78
 
74
- ## Specify author manually
75
-
76
- The plugin will automatically get the author of the document, will parse the email and make a link, also you can specify it manually in `Front Matter`
79
+ ## Configure Author
77
80
 
78
- Priority order: `Front Matter` > `Git Author` > `site_author (mkdocs.yml)` > `PC Username`
81
+ By default, the plugin will **automatically** get the author of the document, and will automatically parse the email and then do the link, without manual intervention
79
82
 
80
- ```yaml
81
- ---
82
- author: any-name
83
- email: e-name@gmail.com
84
- ---
85
-
86
- # Document Title
87
- ```
83
+ - **Priority**: `Front Matter` > `Git Author` > `site_author(mkdocs.yml)` > `PC Username`
84
+ - If you want to customize it, you can configure an author in Front Matter with the field `name`:
85
+ ```markdown
86
+ ---
87
+ name: any-name
88
+ email: e-name@gmail.com
89
+ ---
90
+
91
+ ```
88
92
 
89
- - `author` can be replaced with: `author, name`
90
- - `email` can be replaced with: `email, mail`
93
+ ## Configure Avatar
94
+
95
+ By default, the plugin will **automatically** loads the author avatar, without manual intervention
96
+
97
+ **Priority**: `Custom Avatar` > `GitHub Avatar` > `Character Avatar`
98
+
99
+ 1. Character avatar: will be automatically generated based on the author's name with the following rules
100
+ - Extract initials: English takes the combination of initials, other languages take the first character
101
+ - Dynamic background color: Generate HSL color based on the hash of the name
102
+ 2. GitHub avatar: will be automatically loaded by parsing the `repo_url` property in mkdocs.yml
103
+ 3. Custom avatar: can be customized by customizing the author's `avatar` field in Front Matter
104
+ ```markdown
105
+ ---
106
+ # Way 1: Configure a full author
107
+ author:
108
+ name: jay
109
+ email: jay@qq.com
110
+ avatar: https://xxx.author-avatar-URL.com/xxx.png
111
+ url: https://xxx.website-URL.com/xxx
112
+ description: author description
113
+
114
+ # Way 2: Configure multiple authors
115
+ authors:
116
+ - jaywhj
117
+ - squidfunk
118
+ - sunny
119
+
120
+ ---
121
+ ```
122
+ - If you want to configure complete information for multiple authors, you can create a separate configuration file `.authors.yml` in the `docs/` or `docs/blog/` directory, see the [.authors.yml](https://github.com/jaywhj/mkdocs-document-dates/blob/main/templates/.authors.yml) for its format
123
+ - If the URL avatar fails to load, it falls back to the character avatar
91
124
 
92
125
  ## Customization
93
126
 
94
- The plugin supports deep customization, such as **icon style, theme color, font, animation, dividing line**, etc. Everything is customizable (I've already written the code, you just need to turn on the uncomment switch):
127
+ The plugin supports deep customization, such as **icon style, theme color, font, animation, dividing line**, etc. Everything is customizable (Find the file below and turn on the uncomment switch):
95
128
 
96
129
  | Category: | Location: |
97
130
  | :----------------------: | ---------------------------------------- |
@@ -109,42 +142,22 @@ The plugin supports deep customization, such as **icon style, theme color, font,
109
142
  - assets/document_dates/core/timeago-load.js
110
143
  ```
111
144
 
112
- **Demo Images**:
113
-
114
- ![01-default-w](mkdocs_document_dates/demo_images/01-default-w.png)
115
- ![02-change-icon](mkdocs_document_dates/demo_images/02-change-icon.png)
116
- ![02-change-icon-color](mkdocs_document_dates/demo_images/02-change-icon-color.png)
117
- ![04-default-pop-up](mkdocs_document_dates/demo_images/04-default-pop-up.png)
118
- ![05-change-theme](mkdocs_document_dates/demo_images/05-change-theme.png)
145
+ ![customization](customization.gif)
119
146
 
120
- ![06-change-theme](mkdocs_document_dates/demo_images/06-change-theme.png)
121
- ![08-pop-up-from-bottom](mkdocs_document_dates/demo_images/08-pop-up-from-bottom.png)
122
-
123
- ## Used in templates
147
+ ## Template Variables
124
148
 
125
149
  You can access the meta-info of a document in a template using the following variables:
126
150
 
127
151
  - page.meta.document_dates_created
128
152
  - page.meta.document_dates_modified
129
153
  - page.meta.document_dates_authors
154
+ - page.meta.document_dates_locale
155
+ - page.meta.document_dates_translation
130
156
 
131
- For example like this:
132
-
133
- ```jinja2
134
- <div><span>{{ page.meta.document_dates_created }}</span></div>
135
- <div><span>{{ page.meta.document_dates_modified }}</span></div>
136
- {% set authors = page.meta.document_dates_authors %}
137
- {% if authors %}
138
- <div>
139
- {% for author in authors %}
140
- {% if author.email %}<a href="mailto:{{ author.email }}">{{ author.name }}</a>
141
- {% else %}<span>{{ author.name }}</span>{% endif %}
142
- {% endfor %}
143
- </div>
144
- {% endif %}
145
- ```
157
+ Usage examples:
146
158
 
147
- **Full example**: set the correct lastmod for [sitemap.xml](https://github.com/jaywhj/mkdocs-document-dates/blob/main/sitemap.xml) so that search engines can better handle SEO and thus increase your site's exposure (override path: `docs/overrides/sitemap.xml`)
159
+ - **Example 1**: Set the correct `lastmod` for your site's `sitemap.xml` so that search engines can better handle SEO and thus increase your site's exposure (download [sitemap.xml](https://github.com/jaywhj/mkdocs-document-dates/blob/main/templates/overrides/sitemap.xml) and override this path: `docs/overrides/sitemap.xml`)
160
+ - **Example 2**: Using the template to re-customize the plugin, you have full control over the rendering logic and the plugin is only responsible for providing the data (download [source-file.html](https://github.com/jaywhj/mkdocs-document-dates/blob/main/templates/overrides/partials/source-file.html) and override this path: `docs/overrides/partials/source-file.html`)
148
161
 
149
162
  ## Other Tips
150
163
 
@@ -174,6 +187,8 @@ A dispensable, insignificant little plug-in, friends who have time can take a lo
174
187
  - Solution: I considered using a shell script, but since I'd have to call back to python eventually, it's easier to use a python script. We can detect the user's python environment when the hook is installed, and then dynamically set the hook's shebang line to set the correct python interpreter
175
188
  4. How can I ensure that a single cache file does not conflict when collaborating with multi-person?
176
189
  - Workaround: use JSONL (JSON Lines) instead of JSON, and with the merge strategy 'merge=union'
190
+ 5. How to reduce build time when there are a lot of documents ( >1000 )? Getting git information about a document is usually a file I/O operation, and if there are a lot of files, the efficiency of the operation will plummet. 1,000 documents can be expected to take more than 30 seconds, which is intolerable to the user
191
+ - Solution: Reduce the number of I/Os + Use caching + Replace less efficient system functions
177
192
  - **Improve**:
178
193
  - Since it's a newly developed plugin, it will be designed in the direction of **excellent products**, and the pursuit of the ultimate **ease of use, simplicity and personalization**
179
194
  - **Ease of use**: don't let users do things manually if you can, e.g., auto-install Git Hooks, auto-cache, auto-commit, provide customized templates, etc
@@ -1,7 +1,7 @@
1
1
  import logging
2
2
  import subprocess
3
3
  from pathlib import Path
4
- from .utils import read_json_cache, read_jsonl_cache, write_jsonl_cache, get_file_creation_time, get_git_first_commit_time
4
+ from .utils import read_json_cache, read_jsonl_cache, write_jsonl_cache, get_file_creation_time
5
5
 
6
6
  logger = logging.getLogger("mkdocs.plugins.document_dates")
7
7
  logger.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, CRITICAL
@@ -57,7 +57,7 @@ def update_cache():
57
57
 
58
58
  docs_dir = project_dir / 'docs'
59
59
  if not docs_dir.exists():
60
- logger.error(f"Document directory does not exist: {docs_dir}")
60
+ logger.warning(f"Document directory does not exist: {docs_dir}")
61
61
  continue
62
62
 
63
63
  # 设置.gitattributes文件
@@ -93,11 +93,7 @@ def update_cache():
93
93
  jsonl_dates_cache[rel_path] = json_dates_cache[rel_path]
94
94
  project_updated = True
95
95
  elif full_path.exists():
96
- created_time = get_file_creation_time(full_path)
97
- if not jsonl_cache_file.exists() and not json_cache_file.exists():
98
- git_time = get_git_first_commit_time(full_path)
99
- if git_time:
100
- created_time = min(created_time, git_time)
96
+ created_time = get_file_creation_time(full_path).astimezone()
101
97
  jsonl_dates_cache[rel_path] = {
102
98
  "created": created_time.isoformat()
103
99
  }