{"id":15016624,"url":"https://github.com/olegfedak/eleventy-plugin-relate-collections","last_synced_at":"2026-02-23T19:43:40.449Z","repository":{"id":204354358,"uuid":"711579014","full_name":"olegfedak/eleventy-plugin-relate-collections","owner":"olegfedak","description":"Establish and maintain connections between Eleventy collections, simplifying content relationships for developers.","archived":false,"fork":false,"pushed_at":"2023-11-02T01:39:08.000Z","size":36,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T22:44:19.735Z","etag":null,"topics":["11ty-plugin","eleventy-plugin"],"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/olegfedak.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-29T17:36:34.000Z","updated_at":"2023-11-09T09:26:05.000Z","dependencies_parsed_at":"2024-09-30T09:20:58.380Z","dependency_job_id":null,"html_url":"https://github.com/olegfedak/eleventy-plugin-relate-collections","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"04c3e2ec94f56d988a62286f8ff0c4b88bba7387"},"previous_names":["olegfedak/eleventy-plugin-relate-collections"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olegfedak%2Feleventy-plugin-relate-collections","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olegfedak%2Feleventy-plugin-relate-collections/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olegfedak%2Feleventy-plugin-relate-collections/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olegfedak%2Feleventy-plugin-relate-collections/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olegfedak","download_url":"https://codeload.github.com/olegfedak/eleventy-plugin-relate-collections/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245000448,"owners_count":20545061,"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-plugin","eleventy-plugin"],"created_at":"2024-09-24T19:49:09.499Z","updated_at":"2025-10-24T04:05:07.270Z","avatar_url":"https://github.com/olegfedak.png","language":"JavaScript","funding_links":["https://www.buymeacoffee.com/olegfedak"],"categories":[],"sub_categories":[],"readme":"# Eleventy Plugin Relate Collections\n\nEasily establish and maintain content relationships between Eleventy collections. Simplify content organization and create interconnected pages.\n\n## Installation\n\n```sh\nnpm install eleventy-plugin-relate-collections\n```\n\n## Usage\n\nIn your Eleventy config file (typically .eleventy.js), add the plugin to your configuration:\n\n```js\nconst relateCollections = require(\"eleventy-plugin-relate-collections\");\n\nmodule.exports = function (eleventyConfig) {\n  eleventyConfig.addPlugin(relateCollections, {\n    // Configuration options\n  });\n\n  // Other Eleventy configuration settings...\n};\n\n```\n\n## Configuration\n\nYou can customize the plugin behavior by providing configuration options:\n\n```js\neleventyConfig.addPlugin(relateCollections, {\n  collectionName: \"\", // The collection you want to relate\n  relatedCollectionName: \"\", // The related collection(s)\n  relatedCollectionKey: \"\", // The key(s) to establish the relationship\n  backRelate: true, // Enable back-relations (optional)\n});\n```\n\n## Example\n\nAssuming you have a collection of blog posts and a collection of authors, you can easily relate each blog post to its author using this plugin:\n\n```js\neleventyConfig.addPlugin(relateCollections, {\n  collectionName: \"authors\",\n  relatedCollectionName: \"posts\",\n  relatedCollectionKey: \"author\", // Assuming \"author\" is a key in the \"posts\" collection\n});\n```\n\nNow, you can create relationships between the \"authors\" and \"posts\" collections. In your \"authors\" collection data files, an empty related field will be created to store the related content from the \"posts\" collection:\n\n```json5\nrelated: {\n  name: 'posts',\n  items: [] // Related pages from \"posts\"\n}\n```\n\nWhen you render your Eleventy site, for example, to show related posts for each author, you can use the following code:\n\n```html\n\u003c!-- View the \"authors\" collection --\u003e\n\u003cul\u003e\n  {% for author in collections.authors %}\n    \u003cli\u003e\n      \u003ch2\u003e{{ author.data.title }}\u003c/h2\u003e\n      \u003ch3\u003eRelated Posts:\u003c/h3\u003e\n      \u003cul\u003e\n        {% for related in author.data.related %}\n          {% if related.name == 'posts' %}\n            {% for post in related.items %}\n              \u003cli\u003e\u003ca href=\"{{ post.url }}\"\u003e{{ post.data.title }}\u003c/a\u003e\u003c/li\u003e\n            {% endfor %}\n          {% endif %}\n        {% endfor %}\n      \u003c/ul\u003e\n    \u003c/li\u003e\n  {% endfor %}\n\u003c/ul\u003e\n```\nThis example demonstrates how to use Liquid or Nunjucks to display related data in your Eleventy templates.\n\n## About the Developer\n\nThis Eleventy Plugin Relate Collections is conceived and designed by Oleg Fedak, who is the brain behind the concept and the designer responsible for its development. The implementation, including code and development, is carried out with the assistance of Chat GPT, an AI language model.\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.buymeacoffee.com/olegfedak\"\u003e\n    \u003cimg src=\"coffeeButton.png\" alt=\"Coffee Sponcor button\" width=\"250\" height=\"auto\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folegfedak%2Feleventy-plugin-relate-collections","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folegfedak%2Feleventy-plugin-relate-collections","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folegfedak%2Feleventy-plugin-relate-collections/lists"}