Skip to content
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

page modified date tracking #1

Open
technickle opened this issue Feb 5, 2015 · 4 comments
Open

page modified date tracking #1

technickle opened this issue Feb 5, 2015 · 4 comments

Comments

@technickle
Copy link
Owner

Each page should display the date on which it was last modified. This should be determined automatically, ideally from Jekyll/Liquid variables, and injected into the _layouts/default.html template.

@technickle
Copy link
Owner Author

Can't identify a built-in variable which might do this. It might be possible to embed a "now" function onto each page in the hopes that only modified pages get regenerated by the jekyll engine during the publishing process.

@technickle technickle changed the title page date trackign page modified date tracking Feb 5, 2015
aepstein referenced this issue in aepstein/open-data-resources Feb 5, 2015
@aepstein
Copy link
Collaborator

aepstein commented Feb 5, 2015

Looks like there is a jekyll plugin to support this: jekyll-last-modified-at. Github pages only supports building with plugins they have whitelisted. The gem is not in github-pages, so the only way to use it would be to build the site locally and commit it to the repo. I put a request into github pages to see if they will add this plugin to their (rather short) whitelist (github/pages-gem#119).

@technickle
Copy link
Owner Author

Client-side, using jQuery.ajax(...).getResponseHeader('Last-Modified') or

var xhReq = new XMLHttpRequest();
xhReq.open("HEAD", "My_File.xlsx", false);
xhReq.send(null);
var lastModified = xhReq.getResponseHeader("Last-Modified");

would work, except the github pages jekyll engine seems to update all the files in the compiled site, even if they were not modified during the commit.

@technickle
Copy link
Owner Author

Perhaps the best method I can find is to make an ajax call to the github API:

> $.ajax({url: "https://api.github.com/repos/technickle/open-data-resources/commits?path=/bills/bills.csv", success: function(data){console.log(data[0].commit.author.date)}})
2015-02-12T17:53:27Z

The response is actually an array of commit objects, and they don't seem to be in date/time order, but that could be addressed pretty easily in-code.

The URL can be parameterized in the frontmatter YML for the relevant page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants