Open failfmi opened 11 months ago
The issue here is that, the default docusaurus plugin (i.e.,plugin-content-docs
) that captures the 'date' and 'author' information for doc file uses git log
command to retrieve these information when the options: showLastUpdateAuthor
and showLastUpdateTime
are set to true
.
file: node_modules/@docusaurus/utils/lib/gitUtils.js
function getFileCommitDate(file, { age = 'oldest', includeAuthor = false, }) {
if (!shelljs_1.default.which('git')) {
throw new GitNotFoundError(`Failed to retrieve git history for "${file}" because git is not installed.`);
}
if (!shelljs_1.default.test('-f', file)) {
throw new Error(`Failed to retrieve git history for "${file}" because the file does not exist.`);
}
const args = [
`--format=%ct${includeAuthor ? ',%an' : ''}`,
'--max-count=1',
age === 'oldest' ? '--follow --diff-filter=A' : undefined,
]
.filter(Boolean)
.join(' ');
const result = shelljs_1.default.exec(`git log ${args} -- "${path_1.default.basename(file)}"`, {
As the spec website is a submodule of the spec documentation and the source files are copied to the docusaurus's to 'src/docs' directory at building time, the default plugin cannot get the required information from the local website git repo (because the directory is ignored by the local .gitignore
).
A potential solution I see here is to re-write a new plugin for docusaurus to grab the information from the spec-repo by using git API instead of git log
.
It would be nice to have the date when was the given page last updated. The field exists, it just has to be populated.![image](https://github.com/w3f/polkadot-spec/assets/20928965/f218c12d-cc04-4ecc-94a3-535f9ee8fa77)