Skip to content

Commit b3732e0

Browse files
Added param for git_path
Co-authored-by: William Seiti Mizuta <[email protected]>
1 parent ec6715f commit b3732e0

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Diff for: README.md

+5
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ Specify a two letter [ISO639](https://en.wikipedia.org/wiki/List_of_ISO_639-1_co
9191

9292
If set to `true` (default is `false`) the plugin will use the time when running `mkdocs build` instead of the git revision date. This means the revision date will be inaccurate, but this can be useful if your build environment has no access to GIT and you want to ignore the Git exceptions during `git log`.
9393

94+
### `git_path`
95+
96+
Specify a path to the folder that is a git repository (the folder that contains `.git`). If not specified, default path is `.`.
97+
9498
----
9599

96100
### Example
@@ -104,6 +108,7 @@ plugins:
104108
locale: en
105109
type: timeago
106110
fallback_to_build_date: true
111+
git_path: ./docs
107112
```
108113

109114
Result:

Diff for: mkdocs_git_revision_date_localized_plugin/plugin.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ class GitRevisionDateLocalizedPlugin(BasePlugin):
1616
("fallback_to_build_date", config_options.Type(bool, default=False)),
1717
("locale", config_options.Type(str, default=None)),
1818
("type", config_options.Type(str, default="date")),
19+
("git_path", config_options.Type(str, default=".")),
1920
)
2021

2122
def __init__(self):
22-
self.util = Util()
23+
pass
2324

2425
def on_config(self, config: config_options.Config) -> dict:
2526
"""
@@ -37,6 +38,8 @@ def on_config(self, config: config_options.Config) -> dict:
3738
dict: global configuration object
3839
"""
3940

41+
self.util = Util(path=self.config.get("git_path", "."))
42+
4043
# Get locale settings - might be added in future mkdocs versions
4144
# see: https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/issues/24
4245
mkdocs_locale = config.get("locale", None)

Diff for: mkdocs_git_revision_date_localized_plugin/util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class Util:
13-
def __init__(self, path: str = "./docs"):
13+
def __init__(self, path: str = "."):
1414
self.repo = Git(path)
1515

1616
# Checks when running builds on CI

0 commit comments

Comments
 (0)