-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding support for last-modified (#759)
* adding support for last-modified this includes a new "include" that will allow us to set a boolean, set_last_modified to true on any page to automatically add a last modified date to the bottom left, courtesy of the GitHub commits api. Given that we want to customize either 1. the div id, 2. the repository used (and in this case) 3. the path, those are also exposed as variables to customize (e.g., current set for the code of conduct and governance). Including these changes to templates I have also added the last modified date to be included on most about pages and working group pages, and double checked that the dates are accurate. Thanks Peter for the great idea! Signed-off-by: vsoch <vsoch@users.noreply.github.com> * Removing last modified in governanace Co-authored-by: vsoch <vsoch@users.noreply.github.com>
- Loading branch information
Showing
16 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script> | ||
function setLastModified() { | ||
if (document.getElementById('{% if page.last_modified_id %}{{ page.last_modified_id }}{% else %}last-modified{% endif %}')) { | ||
fetch("https://api.github.com/repos/{% if page.last_modified_repo %}{{ page.last_modified_repo }}{% else %}{{ site.github_org }}/{{ site.github_repo }}{% endif %}/commits?path={% if page.last_modified_path %}{{ page.last_modified_path }}{% else %}{{ page.path }}{% endif %}") | ||
.then((response) => { | ||
return response.json(); | ||
}) | ||
.then((commits) => { | ||
var modified = commits[0]['commit']['committer']['date'].slice(0,10); | ||
console.log(modified) | ||
document.getElementById('last-modified').textContent = "Last Modified: " + modified; | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
}); | ||
} | ||
} | ||
$(document).ready(function(){ | ||
setLastModified(); | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters