mkdocs-document-dates 3.2.1__tar.gz → 3.3.1__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.
- {mkdocs_document_dates-3.2.1/mkdocs_document_dates.egg-info → mkdocs_document_dates-3.3.1}/PKG-INFO +75 -61
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/README.md +73 -59
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/cache_manager.py +5 -1
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/plugin.py +128 -81
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/config/user.config.css +25 -4
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/config/user.config.js +1 -1
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/core/core.css +55 -7
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/core/core.js +49 -1
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/utils.py +12 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1/mkdocs_document_dates.egg-info}/PKG-INFO +75 -61
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/setup.py +3 -3
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/LICENSE +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/MANIFEST.in +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/__init__.py +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/hooks/pre-commit +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/hooks_installer.py +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/core/timeago-load.js +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/core/timeago.full.min.js +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/core/timeago.min.js +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/ar.json +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/de.json +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/en.json +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/es.json +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/fr.json +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/ja.json +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/ko.json +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/ru.json +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/zh.json +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/zh_TW.json +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/backdrop.css +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/light.css +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/material.css +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/popper.min.js +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/scale.css +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/shift-away.css +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/tippy.css +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/tippy.umd.min.js +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates.egg-info/requires.txt +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
- {mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/setup.cfg +0 -0
{mkdocs_document_dates-3.2.1/mkdocs_document_dates.egg-info → mkdocs_document_dates-3.3.1}/PKG-INFO
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mkdocs-document-dates
|
3
|
-
Version: 3.
|
4
|
-
Summary: A new generation MkDocs plugin for displaying exact meta-info
|
3
|
+
Version: 3.3.1
|
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
|
-
A new generation MkDocs plugin for displaying exact meta-info of documents, such as **creation time, last update time, authors, email**, etc
|
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,10 +40,16 @@ A new generation MkDocs plugin for displaying exact meta-info of documents, such
|
|
40
40
|
- Flexible display position (top or bottom)
|
41
41
|
- Elegant styling (fully customizable)
|
42
42
|
- Supports Tooltip Hover Tips
|
43
|
-
- Intelligent
|
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
|
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
|
+
|
47
53
|
|
48
54
|
## Showcases
|
49
55
|
|
@@ -69,52 +75,78 @@ Or, personalize the configuration:
|
|
69
75
|
```yaml
|
70
76
|
plugins:
|
71
77
|
- document-dates:
|
72
|
-
position: top # Display position: top (after title) bottom (end of document)
|
78
|
+
position: top # Display position: top (after title) bottom (end of document)
|
73
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
|
74
83
|
locale: en # Localization: en zh zh_TW es fr de ar ja ko ru, default: en
|
75
84
|
date_format: '%Y-%m-%d' # Date format strings, e.g., %Y-%m-%d, %b %d, %Y, etc
|
76
85
|
time_format: '%H:%M:%S' # Time format strings (valid only if type=datetime)
|
77
|
-
exclude: # List of excluded files
|
78
|
-
- temp.md # Exclude specific file
|
79
|
-
- private/* # Exclude all files in private folder, including subfolders
|
80
86
|
show_author: true # Show author or not, default: true
|
81
87
|
```
|
82
88
|
|
83
89
|
## Specify time manually
|
84
90
|
|
85
|
-
|
86
|
-
|
87
|
-
Priority order: `Front Matter` > `File System Timestamps(Cached)` > `Git Timestamps`
|
88
|
-
|
89
|
-
```yaml
|
90
|
-
---
|
91
|
-
created: 2023-01-01
|
92
|
-
modified: 2025-02-23
|
93
|
-
---
|
94
|
-
|
95
|
-
# Document Title
|
96
|
-
```
|
91
|
+
By default, the plugin will **automatically** get the exact time of the document, and will automatically cache the creation time, without manual intervention
|
97
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
|
+
```
|
98
102
|
- `created` can be replaced with: `created, date, creation`
|
99
103
|
- `modified` can be replaced with: `modified, updated, last_modified, last_updated`
|
100
104
|
|
101
|
-
##
|
102
|
-
|
103
|
-
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
|
104
106
|
|
105
|
-
|
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
|
106
108
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
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
|
+
```
|
115
118
|
|
116
|
-
|
117
|
-
|
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
|
118
150
|
|
119
151
|
## Customization
|
120
152
|
|
@@ -136,16 +168,7 @@ The plugin supports deep customization, such as **icon style, theme color, font,
|
|
136
168
|
- assets/document_dates/core/timeago-load.js
|
137
169
|
```
|
138
170
|
|
139
|
-
|
140
|
-
|
141
|
-

|
142
|
-

|
143
|
-

|
144
|
-

|
145
|
-

|
146
|
-
|
147
|
-

|
148
|
-

|
171
|
+

|
149
172
|
|
150
173
|
## Template Variables
|
151
174
|
|
@@ -154,24 +177,13 @@ You can access the meta-info of a document in a template using the following var
|
|
154
177
|
- page.meta.document_dates_created
|
155
178
|
- page.meta.document_dates_modified
|
156
179
|
- page.meta.document_dates_authors
|
180
|
+
- page.meta.document_dates_locale
|
181
|
+
- page.meta.document_dates_translation
|
157
182
|
|
158
|
-
|
159
|
-
|
160
|
-
```jinja2
|
161
|
-
<div><span>{{ page.meta.document_dates_created }}</span></div>
|
162
|
-
<div><span>{{ page.meta.document_dates_modified }}</span></div>
|
163
|
-
{% set authors = page.meta.document_dates_authors %}
|
164
|
-
{% if authors %}
|
165
|
-
<div>
|
166
|
-
{% for author in authors %}
|
167
|
-
{% if author.email %}<a href="mailto:{{ author.email }}">{{ author.name }}</a>
|
168
|
-
{% else %}<span>{{ author.name }}</span>{% endif %}
|
169
|
-
{% endfor %}
|
170
|
-
</div>
|
171
|
-
{% endif %}
|
172
|
-
```
|
183
|
+
Usage examples:
|
173
184
|
|
174
|
-
**
|
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`)
|
175
187
|
|
176
188
|
## Other Tips
|
177
189
|
|
@@ -201,6 +213,8 @@ A dispensable, insignificant little plug-in, friends who have time can take a lo
|
|
201
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
|
202
214
|
4. How can I ensure that a single cache file does not conflict when collaborating with multi-person?
|
203
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
|
204
218
|
- **Improve**:
|
205
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**
|
206
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
|
-
A new generation MkDocs plugin for displaying exact meta-info of documents, such as **creation time, last update time, authors, email**, etc
|
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,10 +14,16 @@ A new generation MkDocs plugin for displaying exact meta-info of documents, such
|
|
14
14
|
- Flexible display position (top or bottom)
|
15
15
|
- Elegant styling (fully customizable)
|
16
16
|
- Supports Tooltip Hover Tips
|
17
|
-
- Intelligent
|
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
|
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
|
+
|
21
27
|
|
22
28
|
## Showcases
|
23
29
|
|
@@ -43,52 +49,78 @@ Or, personalize the configuration:
|
|
43
49
|
```yaml
|
44
50
|
plugins:
|
45
51
|
- document-dates:
|
46
|
-
position: top # Display position: top (after title) bottom (end of document)
|
52
|
+
position: top # Display position: top (after title) bottom (end of document)
|
47
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
|
48
57
|
locale: en # Localization: en zh zh_TW es fr de ar ja ko ru, default: en
|
49
58
|
date_format: '%Y-%m-%d' # Date format strings, e.g., %Y-%m-%d, %b %d, %Y, etc
|
50
59
|
time_format: '%H:%M:%S' # Time format strings (valid only if type=datetime)
|
51
|
-
exclude: # List of excluded files
|
52
|
-
- temp.md # Exclude specific file
|
53
|
-
- private/* # Exclude all files in private folder, including subfolders
|
54
60
|
show_author: true # Show author or not, default: true
|
55
61
|
```
|
56
62
|
|
57
63
|
## Specify time manually
|
58
64
|
|
59
|
-
|
60
|
-
|
61
|
-
Priority order: `Front Matter` > `File System Timestamps(Cached)` > `Git Timestamps`
|
62
|
-
|
63
|
-
```yaml
|
64
|
-
---
|
65
|
-
created: 2023-01-01
|
66
|
-
modified: 2025-02-23
|
67
|
-
---
|
68
|
-
|
69
|
-
# Document Title
|
70
|
-
```
|
65
|
+
By default, the plugin will **automatically** get the exact time of the document, and will automatically cache the creation time, without manual intervention
|
71
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
|
+
```
|
72
76
|
- `created` can be replaced with: `created, date, creation`
|
73
77
|
- `modified` can be replaced with: `modified, updated, last_modified, last_updated`
|
74
78
|
|
75
|
-
##
|
76
|
-
|
77
|
-
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
|
78
80
|
|
79
|
-
|
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
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|
+
```
|
89
92
|
|
90
|
-
|
91
|
-
|
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
|
92
124
|
|
93
125
|
## Customization
|
94
126
|
|
@@ -110,16 +142,7 @@ The plugin supports deep customization, such as **icon style, theme color, font,
|
|
110
142
|
- assets/document_dates/core/timeago-load.js
|
111
143
|
```
|
112
144
|
|
113
|
-
|
114
|
-
|
115
|
-

|
116
|
-

|
117
|
-

|
118
|
-

|
119
|
-

|
120
|
-
|
121
|
-

|
122
|
-

|
145
|
+

|
123
146
|
|
124
147
|
## Template Variables
|
125
148
|
|
@@ -128,24 +151,13 @@ You can access the meta-info of a document in a template using the following var
|
|
128
151
|
- page.meta.document_dates_created
|
129
152
|
- page.meta.document_dates_modified
|
130
153
|
- page.meta.document_dates_authors
|
154
|
+
- page.meta.document_dates_locale
|
155
|
+
- page.meta.document_dates_translation
|
131
156
|
|
132
|
-
|
133
|
-
|
134
|
-
```jinja2
|
135
|
-
<div><span>{{ page.meta.document_dates_created }}</span></div>
|
136
|
-
<div><span>{{ page.meta.document_dates_modified }}</span></div>
|
137
|
-
{% set authors = page.meta.document_dates_authors %}
|
138
|
-
{% if authors %}
|
139
|
-
<div>
|
140
|
-
{% for author in authors %}
|
141
|
-
{% if author.email %}<a href="mailto:{{ author.email }}">{{ author.name }}</a>
|
142
|
-
{% else %}<span>{{ author.name }}</span>{% endif %}
|
143
|
-
{% endfor %}
|
144
|
-
</div>
|
145
|
-
{% endif %}
|
146
|
-
```
|
157
|
+
Usage examples:
|
147
158
|
|
148
|
-
**
|
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`)
|
149
161
|
|
150
162
|
## Other Tips
|
151
163
|
|
@@ -175,6 +187,8 @@ A dispensable, insignificant little plug-in, friends who have time can take a lo
|
|
175
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
|
176
188
|
4. How can I ensure that a single cache file does not conflict when collaborating with multi-person?
|
177
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
|
178
192
|
- **Improve**:
|
179
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**
|
180
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
|
{mkdocs_document_dates-3.2.1 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/cache_manager.py
RENAMED
@@ -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
|
4
|
+
from .utils import read_json_cache, read_jsonl_cache, write_jsonl_cache, get_file_creation_time, get_git_first_commit_time
|
5
5
|
|
6
6
|
logger = logging.getLogger("mkdocs.plugins.document_dates")
|
7
7
|
logger.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, CRITICAL
|
@@ -94,6 +94,10 @@ def update_cache():
|
|
94
94
|
project_updated = True
|
95
95
|
elif full_path.exists():
|
96
96
|
created_time = get_file_creation_time(full_path).astimezone()
|
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)
|
97
101
|
jsonl_dates_cache[rel_path] = {
|
98
102
|
"created": created_time.isoformat()
|
99
103
|
}
|