-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow option to display "last edited/modified" person and date #383
Comments
This is also a feature I have wanted since Day 0. Problem is, none of us have been able to figure out how to accomplish writing this data in an automated process that doesn't introduce multiple levels of complexity and remote calls. To get this data for a single page, the Those calls would also add plenty of delay to build process and breaks our prime directive of no remote calls during build. Could it all be setup? yes, of course. We could also probably add a special command line There is a way to add this info to the page manually, using the ---
author:
name: Frank Esposito
date: 2022-08-10 # August 10, 2022
--- |
Another option for the date could be adding something to the footer:
copyright: "© Copyright. Last updated: 2022-08-10." |
Suggestion, which favors simplicity and the principle of least knowledge: How about simply using the File Modification time? Obviously, users who are cloning the repo using git, will simply need to run a command that restores the file's modified time from the repository prior to rendering. This command does that: git log --pretty=%at --name-status --reverse | perl -ane '($x,$f)=@F;next if !$x;$t=$x,next if !defined($f)||$s{$f};$s{$f}=utime($t,$t,$f),next if $x=~/[AM]/;' as extracted from this StackOverflow answer |
I think the way to get this Last modified value into the generated .html pages will be creating a GitHub action that injects the datatime stamp using either of the following techniques: Option 1: Inject into the .md before build
Option 2: Inject into the .html after build
Step 1 is not currently being injected by Retype. As a temp work around, manually adding an HTML Either technique would only work with the page .md files. Revising the content of an include or any other dynamic content would not trigger the last updated value to change, even though the content of the generated .html page might actually be changing in that case. As well, any change to the page .md file would trigger the last updated value to update, including revising any of the page meta data. Both of the techniques require a GitHub action/workflow and happen outside of the scope of the actual retypeapp. Just some thoughts. Let me know what you think. |
Sorry, I don't like this at all. This is an over-engineered, tightly coupled (not not only with git, but with GitHub Actions), complex solution. I understand going for the complex solution when there is none other, but this is not the case. What is wrong with this?
|
I believe cloning a repo sets/resets the LastModifiedTime value of the file on the client. The only way I know to get an accurate and reliable value is using The following script loops through all the .md files in a folder (project) and logs the file name and author date (
The above logs the following for the retype project:
|
You must have missed my previous comment: #383 (comment) It is easier to add this command to your official github action, after git clone, before build, than to implement everything you mentioned, and create an implementation so tightly coupled with things it shouldn't be coupled with. git log --pretty=%at --name-status --reverse | perl -ane '($x,$f)=@F;next if !$x;$t=$x,next if !defined($f)||$s{$f};$s{$f}=utime($t,$t,$f),next if $x=~/[AM]/;' |
okay, yes, this has potential. I'll see if we can make this all work. |
A lot of my content relies on the date to show whether it's still relevant or not. I think people appreciate knowing whether my project contents are stale or not (and most of my users won't check GitHub; some probably don't even know my content is publicly available here). It would be great if the option existed for the project owner to determine (perhaps on a project or a page-by-page basis) whether the last edited date should be shown. Additionally, it would be useful (more so for the project owner than the users) if the ability existed to show who that person was.
The text was updated successfully, but these errors were encountered: