How to get lastUpdated date of page?
See original GitHub issueBug Report
I am trying to display the lastupdate time on each page. However, the lastupdated time o all pages is the same, even though I just updated one of them.
Steps to reproduce
I am using this to get the time:
...
hook.beforeEach(function(html) {
return addLastUpdatedPlaceholder(html);
});
hook.afterEach(function(html, next) {
const plugins = [insertLastUpdated];
const finalHtml = plugins.reduce((accHtml, plugin) => plugin(accHtml), html);
next(finalHtml);
});
...
function addLastUpdatedPlaceholder(html) {
var footer = [
'\n<footer class="last-updated">',
`<small>__lastupdated__</small>`,
'</footer>'
].join('');
return html + footer;
}
function insertLastUpdated(html) {
return html.replace(/__lastupdated__/, `Page last updated: ${window.$docsify.lastUpdated}`);
}
What is current behaviour
Displaying same time on all pages.
What is the expected behaviour
Display time of when page was last updated.
Other relevant information
-
[ x] Bug does still occur when all/other plugins are disabled?
-
Your OS: OSX
-
Node.js version: 10.15.3
-
npm/yarn version: 6.4.1
-
Browser version: Chrome 83
-
Docsify version: 4.4.0
-
Docsify plugins: Custom
Please create a reproducible sandbox
Mention the docsify version in which this bug was not present (if any)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
9 Ways to Check Webpage Last Updated Time [Step-by-Step]
Open the webpage. Look for the content metadata next to the page title or at the beginning/end of the webpage. Find a date...
Read more >How to find out when a website was last ... - The Windows Club
Open the website that you need to check. Hit the F12 key on your keyboard. ... An alert will be invoked on the...
Read more >How to Find the Most Recently Updated Date of a Web Page
To find the last updated date, simply use a free Google cache checking tool. Or, find the cached data in your Google Search....
Read more >How To Check When a Website Was Last Updated? - Siteefy
4 Simple Checks To See When a Website Was Last Updated · 1. View the Source Code · 2. Check the XML Sitemap...
Read more >Determine Last Modified Date of a Web Page - Computer Hope
Perform Google search · Paste what you copied into a Google search, or the omnibox at the top of your browser, and then...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you can use
{docsify-updated}
for example :
However, if you deploy using a github page, you usually get the same time.
I think this did it:
As per, https://github.com/docsifyjs/docsify/blob/314e2d9d39a024270403a42eb19bd98e6cce8d17/docs/write-a-plugin.md