{"id":15641063,"url":"https://github.com/saneef/eleventy-plugin-git-commit-date","last_synced_at":"2025-04-30T09:06:49.718Z","repository":{"id":47656943,"uuid":"397881724","full_name":"saneef/eleventy-plugin-git-commit-date","owner":"saneef","description":"Eleventy plugin to get recent Git commit time of a file, or a Eleventy collection.","archived":false,"fork":false,"pushed_at":"2023-06-26T07:56:54.000Z","size":37,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-23T16:08:23.988Z","etag":null,"topics":["11ty","11ty-plugin","date","eleventy","eleventy-plugin","git","git-commit"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saneef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"saneef","ko_fi":"saneef","patreon":"saneef"}},"created_at":"2021-08-19T09:06:25.000Z","updated_at":"2025-01-19T11:29:55.000Z","dependencies_parsed_at":"2024-10-03T11:51:28.966Z","dependency_job_id":null,"html_url":"https://github.com/saneef/eleventy-plugin-git-commit-date","commit_stats":{"total_commits":22,"total_committers":2,"mean_commits":11.0,"dds":"0.13636363636363635","last_synced_commit":"556fd39583b33ca46f4b9c79e12fe9d5b0aaaaa1"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saneef%2Feleventy-plugin-git-commit-date","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saneef%2Feleventy-plugin-git-commit-date/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saneef%2Feleventy-plugin-git-commit-date/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saneef%2Feleventy-plugin-git-commit-date/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saneef","download_url":"https://codeload.github.com/saneef/eleventy-plugin-git-commit-date/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251311332,"owners_count":21569008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["11ty","11ty-plugin","date","eleventy","eleventy-plugin","git","git-commit"],"created_at":"2024-10-03T11:41:16.751Z","updated_at":"2025-04-30T09:06:49.652Z","avatar_url":"https://github.com/saneef.png","language":"JavaScript","funding_links":["https://github.com/sponsors/saneef","https://ko-fi.com/saneef","https://patreon.com/saneef"],"categories":[],"sub_categories":[],"readme":"# eleventy-plugin-git-commit-date\n\nThis Eleventy plugin provides two [template filters](https://www.11ty.dev/docs/filters/):\n\n| Filter                             | Description                                                                                                                                   |\n| :--------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- |\n| `getGitCommitDateFromPath`         | Gets Git commit date from path.\u003cbr\u003e\u003cbr\u003eUsage: `{{ page.inputPath \\| getGitCommitDateFromPath }}`                                              |\n| `getCollectionNewestGitCommitDate` | Get Git commit date of the newest committed file from a collection.\u003cbr\u003e\u003cbr\u003eUsage: `{{ collections.all \\| getCollectionNewestGitCommitDate }}` |\n\n🌏 This plugin is made primarily to populate `\u003cupdated\u003e` fields in an RSS feed. Here is [a blog post on how to use this plugin](https://saneef.com/tutorials/fix-dates-on-eleventy-rss-feeds/) with [`eleventy-plugin-rss`](https://www.11ty.dev/docs/plugins/rss/).\n\n⚠️ Getting Git commit date is a bit slow (\\~50ms for each path). So, use it sparingly. It's recommended to call this filter within a production flag.\n\n## Usage\n\n### 1. Install\n\n```sh\nnpm install eleventy-plugin-git-commit-date\n```\n\n### 2. Add to Eleventy config\n\n```js\n// .eleventy.js\n\nconst pluginGitCommitDate = require(\"eleventy-plugin-git-commit-date\");\n\nmodule.exports = function (eleventyConfig) {\n  eleventyConfig.addPlugin(pluginGitCommitDate);\n};\n```\n\n### 3. Use in templates\n\n```nunjucks\nUsing {{ page.inputPath | getGitCommitDateFromPath }} will display the git commit date of the file using a local time zone like:\n\nSun Dec 31 2017 18:00:00 GMT-0600 (Central Standard Time)\n\nUsing {{ collections.all | getCollectionNewestGitCommitDate }} will display the git commit date of newest file in the collection using a local time zone like:\n\nSun Dec 31 2017 18:00:00 GMT-0600 (Central Standard Time)\n```\n\n## FAQs\n\n### When used with GitHub Pages, why are the last commit dates incorrect?\n\nOnly the last commit is checked out by [GitHub Action Checkout](https://github.com/actions/checkout#:~:text=Only%20a%20single%20commit%20is%20fetched%20by%20default) by default. The commit dates for files changed in the previous commits will not be available. You can set the `fetch-depth` as `0` to get all the history from the Git repository.\n\n```diff\n   - name: Checkout\n     uses: actions/checkout@v3\n+    with:\n+      fetch-depth: 0\n```\n\n## Credits\n\n- [@zachleat](https://github.com/11ty/eleventy/issues/142) suggested the use of Git commit dates instead of modified date.\n- The code is based on [@vuepress/plugin-last-updated](https://github.com/vuejs/vuepress/tree/master/packages/@vuepress/plugin-last-updated).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaneef%2Feleventy-plugin-git-commit-date","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaneef%2Feleventy-plugin-git-commit-date","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaneef%2Feleventy-plugin-git-commit-date/lists"}