{"id":18383053,"url":"https://github.com/timkelty/craft-groupby","last_synced_at":"2025-04-06T23:32:04.164Z","repository":{"id":23754587,"uuid":"27128840","full_name":"timkelty/craft-groupby","owner":"timkelty","description":"Craft plugin (Twig filter) for grouping entries.","archived":false,"fork":false,"pushed_at":"2019-03-08T11:26:49.000Z","size":14,"stargazers_count":23,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T03:47:51.071Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/timkelty.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-11-25T14:14:29.000Z","updated_at":"2023-03-20T13:47:00.000Z","dependencies_parsed_at":"2022-08-22T05:50:23.240Z","dependency_job_id":null,"html_url":"https://github.com/timkelty/craft-groupby","commit_stats":null,"previous_names":["timkelty/groupby-craft"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkelty%2Fcraft-groupby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkelty%2Fcraft-groupby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkelty%2Fcraft-groupby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkelty%2Fcraft-groupby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timkelty","download_url":"https://codeload.github.com/timkelty/craft-groupby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247569124,"owners_count":20959758,"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":[],"created_at":"2024-11-06T01:09:54.725Z","updated_at":"2025-04-06T23:32:02.113Z","avatar_url":"https://github.com/timkelty.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# groupBy\n\nA Craft plugin (Twig filter) for grouping entries.\n\nNote: I have no plan to update this plugin for Craft 3. See https://github.com/sjelfull/craft3-collections, which can do the same thing, but also much more.\n\n## Usage\n\n* `param 1`: Attribute to group by, in dot notation\n* `param 2`: Group un-grouped entries by a key. Defaults to `false`, meaning un-grouped items are removed. These entries are always added to the end of the returned array.\n\n```\n{% set allEntries = craft.entries.section('blog').find() %}\n{% set allEntriesByCat = allEntries|groupBy('myCategoryField.slug', 'unGrouped') %}\n```\n\n## Examples\n\nIn it's simplest form, the `groupBy` filter works like [Craft's native `group` filter][1].\n\n```\n{% set allEntries = craft.entries.section('blog').find() %}\n{% set allEntriesByYear = allEntries|groupBy('postDate.year') %}\n```\n\nHowever, `groupBy` can also group by nested objects:\n\n```\n{% set allEntriesByCat = allEntries|groupBy('myCategoryField.slug') %}\n{% set allEntriesBySection = allEntries|groupBy('section.title') %}\n```\n\nAnd you can even get really crazy if you want:\n\n```\n{% set allEntriesByNestedCat = allEntries|groupBy('myEntriesField.myCategoryField.slug') %}\n{% set allEntriesByMatrix = allEntries|groupBy('myMatrix.myEntriesField.dateField.localeDate') %}\n```\n\n## Discussion\n\n[Motivation for plugin on StackExchange][2]\n\n[1]: http://buildwithcraft.com/docs/templating/filters#group\n[2]: http://craftcms.stackexchange.com/questions/4832/is-it-possible-to-group-entries-by-checkbox/4834#4834\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimkelty%2Fcraft-groupby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimkelty%2Fcraft-groupby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimkelty%2Fcraft-groupby/lists"}