mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-20 20:46:58 +02:00
fix: improve last updated time feature (#1036)
This commit is contained in:
parent
ff11d17625
commit
b577f60d4a
3 changed files with 58 additions and 39 deletions
|
@ -41,9 +41,11 @@ class DocsLayout extends React.Component {
|
|||
const id = metadata.localized_id;
|
||||
const defaultTitle = metadata.title;
|
||||
let DocComponent = Doc;
|
||||
|
||||
if (this.props.Doc) {
|
||||
DocComponent = this.props.Doc;
|
||||
}
|
||||
|
||||
let updateTime;
|
||||
if (this.props.config.enableUpdateTime) {
|
||||
const filepath = docs.getFilePath(metadata);
|
||||
|
@ -88,6 +90,15 @@ class DocsLayout extends React.Component {
|
|||
version={metadata.version}
|
||||
language={metadata.language}
|
||||
/>
|
||||
{this.props.config.enableUpdateTime &&
|
||||
updateTime && (
|
||||
<div className="docLastUpdateTimestamp">
|
||||
<em>
|
||||
<strong>Last updated: </strong>
|
||||
{updateTime}
|
||||
</em>
|
||||
</div>
|
||||
)}
|
||||
<div className="docs-prevnext">
|
||||
{metadata.previous_id && (
|
||||
<a
|
||||
|
@ -123,13 +134,6 @@ class DocsLayout extends React.Component {
|
|||
</a>
|
||||
)}
|
||||
</div>
|
||||
{this.props.config.enableUpdateTime &&
|
||||
updateTime && (
|
||||
<p style={{fontSize: '12px', textAlign: 'right'}}>
|
||||
<strong>Last updated: </strong>
|
||||
{updateTime}
|
||||
</p>
|
||||
)}
|
||||
</Container>
|
||||
{hasOnPageNav && (
|
||||
<nav className="onPageNav docOnPageNav">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue