{"id":13612291,"url":"https://github.com/rob-murray/jekyll-version-plugin","last_synced_at":"2025-04-28T05:34:51.983Z","repository":{"id":17556789,"uuid":"20359726","full_name":"rob-murray/jekyll-version-plugin","owner":"rob-murray","description":"A Liquid tag plugin for Jekyll that renders a version identifier for your Jekyll site, sourced from the git repository.","archived":false,"fork":false,"pushed_at":"2021-05-26T20:17:37.000Z","size":29,"stargazers_count":29,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T20:56:35.311Z","etag":null,"topics":["git","jekyll","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/rob-murray.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-31T16:18:09.000Z","updated_at":"2023-11-29T02:53:49.000Z","dependencies_parsed_at":"2022-08-25T18:01:17.722Z","dependency_job_id":null,"html_url":"https://github.com/rob-murray/jekyll-version-plugin","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob-murray%2Fjekyll-version-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob-murray%2Fjekyll-version-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob-murray%2Fjekyll-version-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob-murray%2Fjekyll-version-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rob-murray","download_url":"https://codeload.github.com/rob-murray/jekyll-version-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224099355,"owners_count":17255557,"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":["git","jekyll","ruby"],"created_at":"2024-08-01T20:00:26.673Z","updated_at":"2024-11-11T11:49:10.440Z","avatar_url":"https://github.com/rob-murray.png","language":"Ruby","readme":"## jekyll-version-plugin\n\n[![Gem Version](https://badge.fury.io/rb/jekyll_version_plugin.svg)](http://badge.fury.io/rb/jekyll_version_plugin)\n\n### Description\n\nA Liquid tag plugin for [Jekyll](http://jekyllrb.com/) that renders a version identifier for your Jekyll site sourced from the `git` repository containing your code. Great if you want to display the version of your project on your site automatically each time your site is built.\n\nIdentify and highlight the build of your project by calling the tag from your Jekyll project.\n\n##### This Jekyll view code will generate ...\n\nGiven a `git` repo with the latest tag of *3.0.0* and *5* commits since tagged, the commit `ga189420` being the latest.\n\n```ruby\n\u003cp\u003eBuild: {% project_version %}\u003c/p\u003e\n```\n\n##### This html\n\n```html\n\u003cp\u003eBuild: 3.0.0-5-ga189420\u003c/p\u003e\n```\n\n\n### Features\n\nThe **jekyll-version-plugin** has 1x feature with a few options;\n\n* Render a version of your project via `git`.\n  * Use the `git-describe` command with *long* or *short* option\n  * Use the `git rev-parse` on **HEAD** with *long* or *short* option\n\n\n### Requirements\n\n* Your project is version controlled in `git`.\n\n\n### Usage\n\nAs mentioned by [Jekyll's documentation](http://jekyllrb.com/docs/plugins/#installing-a-plugin) you have two options; manually import the source file or require the plugin as a `gem`.\n\n\n#### Require gem\n\nAdd the `jekyll_version_plugin` to your site `_config.yml` file for Jekyll to import the plugin as a gem.\n\n```ruby\ngems: ['jekyll_version_plugin']\n```\n\n\n#### Manual import\n\nJust download the source file into your `_plugins` directory, e.g.\n\n```bash\n# Create the _plugins dir if needed and download project_version_tag plugin\n$ mkdir -p _plugins \u0026\u0026 cd _plugins\n$ wget https://raw.githubusercontent.com/rob-murray/jekyll-version-plugin/master/lib/jekyll_version_plugin.rb\n```\n\n\n#### Plugin tag usage\n\nThe plugin can be called anywhere in your template with or without parameters;\n\n```ruby\n{% project_version *params %}\n{% project_version type format %}\n```\n\n* **type** is what to use for versioning, either `tag` or `commit` - defaults to `tag`\n* **format** is the format of the output, `short` or `long` - defaults to `short`\n\nWherever you want to display the version, just add one of the snippets below in your content and the version will be rendered when the Jekyll project is built.\n\n\n```ruby\n# Default options of `tag short`\n{% project_version %} # =\u003e will run `git describe --tags --always`\n\n# To render a short tag description like `3.0.0`\n{% project_version tag short %} # =\u003e will run `git describe --tags --always`\n\n# To render a more details tag description like `3.0.0-5-ga189420`\n{% project_version tag long %} # =\u003e will run `git describe --tags --always --long`\n\n# To render a short commitish like `151ebce`\n{% project_version commit short %} # =\u003e will run `git rev-parse --short HEAD`\n\n# To render a longer commitsh like `151ebce149c5886bcf2923db18d73742901eb976`\n{% project_version commit long %} # =\u003e will run `git rev-parse HEAD`\n```\n\nThis will simply output the version number, you can then apply your own styling as necessary. Or just `html` comment it out if you don't want it visible.\n\n\n### Output\n\nHappy path is a `git` repo with releases that are tagged, if this is the case then the output will be something like this;\n\n`3.0.0` or `3.0.0-5-ga189420`\n\nIf you select the *commit* option then the output will be something like this;\n\n`a189420`\n\nIf you have selected the *tags* option and the repository does not have any `tags` then it will grab the short sha of the last commit, see above;\n\nIf for any reason this fails then the output will just be a *sorry* message. Sorry about that.\n\n`Sorry, could not read project version at the moment`\n\n\n### Technical wizardry\n\nThe plugin just calls `git describe` or `git rev-parse HEAD` - For more information see [git-describe](http://git-scm.com/docs/git-describe) and [git rev-parse](https://git-scm.com/docs/git-rev-parse).\n\n```bash\n$ git describe --tags --long\n$ git rev-parse --short HEAD\n```\n\n\n### Contributions\n\nPlease use the GitHub pull-request mechanism to submit contributions.\n\n\n### License\n\nThis project is available for use under the MIT software license.\nSee LICENSE\n","funding_links":[],"categories":["Tags","Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frob-murray%2Fjekyll-version-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frob-murray%2Fjekyll-version-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frob-murray%2Fjekyll-version-plugin/lists"}