{"id":27931369,"url":"https://github.com/docpad/docpad-plugin-associatedfiles","last_synced_at":"2025-05-07T03:15:08.877Z","repository":{"id":5092231,"uuid":"6254756","full_name":"docpad/docpad-plugin-associatedfiles","owner":"docpad","description":"DocPad plugin that fetches any associated files for our particular document","archived":false,"fork":false,"pushed_at":"2024-02-04T18:38:41.000Z","size":221,"stargazers_count":7,"open_issues_count":7,"forks_count":6,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-07T03:15:01.905Z","etag":null,"topics":["docpad-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ACRA/acra","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/docpad.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["balupton"],"patreon":"bevry","open_collective":"bevry","ko_fi":"balupton","liberapay":"bevry","custom":["https://bevry.me/fund"]}},"created_at":"2012-10-17T01:58:38.000Z","updated_at":"2020-11-22T05:13:16.000Z","dependencies_parsed_at":"2023-01-16T21:00:31.175Z","dependency_job_id":null,"html_url":"https://github.com/docpad/docpad-plugin-associatedfiles","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-associatedfiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-associatedfiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-associatedfiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-associatedfiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/docpad","download_url":"https://codeload.github.com/docpad/docpad-plugin-associatedfiles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252804225,"owners_count":21806773,"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":["docpad-plugin"],"created_at":"2025-05-07T03:15:08.250Z","updated_at":"2025-05-07T03:15:08.871Z","avatar_url":"https://github.com/docpad.png","language":"JavaScript","funding_links":["https://github.com/sponsors/balupton","https://patreon.com/bevry","https://opencollective.com/bevry","https://ko-fi.com/balupton","https://liberapay.com/bevry","https://bevry.me/fund","https://buymeacoffee.com/balupton"],"categories":[],"sub_categories":[],"readme":"# Associated Files Plugin for [DocPad](http://docpad.org)\n\n\u003c!-- BADGES/ --\u003e\n\n\u003cspan class=\"badge-travisci\"\u003e\u003ca href=\"http://travis-ci.com/docpad/docpad-plugin-associatedfiles\" title=\"Check this project's build status on TravisCI\"\u003e\u003cimg src=\"https://img.shields.io/travis/com/docpad/docpad-plugin-associatedfiles/master.svg\" alt=\"Travis CI Build Status\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-npmversion\"\u003e\u003ca href=\"https://npmjs.org/package/docpad-plugin-associatedfiles\" title=\"View this project on NPM\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/docpad-plugin-associatedfiles.svg\" alt=\"NPM version\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-npmdownloads\"\u003e\u003ca href=\"https://npmjs.org/package/docpad-plugin-associatedfiles\" title=\"View this project on NPM\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/docpad-plugin-associatedfiles.svg\" alt=\"NPM downloads\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-daviddm\"\u003e\u003ca href=\"https://david-dm.org/docpad/docpad-plugin-associatedfiles\" title=\"View the status of this project's dependencies on DavidDM\"\u003e\u003cimg src=\"https://img.shields.io/david/docpad/docpad-plugin-associatedfiles.svg\" alt=\"Dependency Status\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-daviddmdev\"\u003e\u003ca href=\"https://david-dm.org/docpad/docpad-plugin-associatedfiles#info=devDependencies\" title=\"View the status of this project's development dependencies on DavidDM\"\u003e\u003cimg src=\"https://img.shields.io/david/dev/docpad/docpad-plugin-associatedfiles.svg\" alt=\"Dev Dependency Status\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cbr class=\"badge-separator\" /\u003e\n\u003cspan class=\"badge-githubsponsors\"\u003e\u003ca href=\"https://github.com/sponsors/balupton\" title=\"Donate to this project using GitHub Sponsors\"\u003e\u003cimg src=\"https://img.shields.io/badge/github-donate-yellow.svg\" alt=\"GitHub Sponsors donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-patreon\"\u003e\u003ca href=\"https://patreon.com/bevry\" title=\"Donate to this project using Patreon\"\u003e\u003cimg src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-flattr\"\u003e\u003ca href=\"https://flattr.com/profile/balupton\" title=\"Donate to this project using Flattr\"\u003e\u003cimg src=\"https://img.shields.io/badge/flattr-donate-yellow.svg\" alt=\"Flattr donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-liberapay\"\u003e\u003ca href=\"https://liberapay.com/bevry\" title=\"Donate to this project using Liberapay\"\u003e\u003cimg src=\"https://img.shields.io/badge/liberapay-donate-yellow.svg\" alt=\"Liberapay donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-buymeacoffee\"\u003e\u003ca href=\"https://buymeacoffee.com/balupton\" title=\"Donate to this project using Buy Me A Coffee\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg\" alt=\"Buy Me A Coffee donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-opencollective\"\u003e\u003ca href=\"https://opencollective.com/bevry\" title=\"Donate to this project using Open Collective\"\u003e\u003cimg src=\"https://img.shields.io/badge/open%20collective-donate-yellow.svg\" alt=\"Open Collective donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-crypto\"\u003e\u003ca href=\"https://bevry.me/crypto\" title=\"Donate to this project using Cryptocurrency\"\u003e\u003cimg src=\"https://img.shields.io/badge/crypto-donate-yellow.svg\" alt=\"crypto donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-paypal\"\u003e\u003ca href=\"https://bevry.me/paypal\" title=\"Donate to this project using Paypal\"\u003e\u003cimg src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-wishlist\"\u003e\u003ca href=\"https://bevry.me/wishlist\" title=\"Buy an item on our wishlist for us\"\u003e\u003cimg src=\"https://img.shields.io/badge/wishlist-donate-yellow.svg\" alt=\"Wishlist browse button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\n\u003c!-- /BADGES --\u003e\n\n\nThis plugin streamlines finding associated files for a particular document in [DocPad](https://docpad.org), which is useful for:\n\n-   getting images for a gallery\n-   getting downloads for an article\n-   etc. etc.\n\n## Install\n\n```bash\ndocpad install associatedfiles\n```\n\n## Usage\n\nThe way it works is by looking into `src/files/associated-files/#{document.associatedFilesPath or document.basename}` for files. Where `associatedFilesPath` is set in your document's meta data, and if it doesn't exist it will use the document's basename (e.g. the basename of `my-holiday-2012.html.eco` is `my-holiday-2012`). Any files inside that path will be associated to your document, and retrieveable by `@getDocument().getAssociatedFiles()`\n\nLets see how this works, we have the document `src/documents/my-holiday-2012.html.eco`:\n\n```html\n---\ntitle: My Holiday in 2012\n---\n\n\u003ch2\u003eHere are some great photos from our trip\u003c/h2\u003e\n\n\u003c% for file in @getDocument().getAssociatedFiles().toJSON(): %\u003e\n\u003cp\u003e\n\t\u003ch3\u003e\u003c%= file.title or file.name %\u003e\u003c/h3\u003e\n\t\u003cimg src=\"\u003c%= file.url %\u003e\" title=\"\u003c%= file.title or file.name %\u003e\" /\u003e\n\u003c/p\u003e\n\u003c% end %\u003e\n```\n\nThen we will stick a few images inside our path: `src/files/associated-files/my-holiday-2012`. And we'll end up with the rendered result:\n\n```html\n\u003ch2\u003eHere are some great photos from our trip\u003c/h2\u003e\n\n\u003cp\u003e\n\t\u003ch3\u003esweet-sweet-beach.jpg\u003c/h3\u003e\n\t\u003cimg src=\"/associated-files/my-holiday-2012/sweet-sweet-beach.jpg\" title=\"sweet-sweet-beach.jpg\" /\u003e\n\u003c/p\u003e\n\n\u003cp\u003e\n\t\u003ch3\u003esweet-sweet-icecream.jpg\u003c/h3\u003e\n\t\u003cimg src=\"/associated-files/my-holiday-2012/sweet-sweet-icecream.jpg\" title=\"sweet-sweet-icecream.jpg\" /\u003e\n\u003c/p\u003e\n```\n\n## Configure\n\n### Defaults\n\nThe default configuration for this plugin is the equivalant of adding the following options to your [DocPad configuration file](http://docpad.org/docs/config):\n\n```coffee\nplugins:\n\tassociatedfiles:\n\t\t# The paths for the associated files.\n\t\tassociatedFilesPath: 'associated-files'\n\n\t\t# Whether to use relative base paths for the document. This would\n\t\t# use associated-files/subfolder/myarticle/image.jpg instead of\n\t\t# associated-files/myarticle/image.jpg.\n\t\tuseRelativeBase: false\n```\n\n### Template Configuration\n\nIt is possible to override the default configuration on a per-template basis:\n\n```html\n---\nassociatedFilesRelative: true\nassociatedFilesPath: './myfolder'\n---\n\n\u003c% for file in @getDocument().getAssociatedFiles().toJSON(): %\u003e\n\u003cp\u003e\n\t\u003ch3\u003e\u003c%= file.title or file.name %\u003e\u003c/h3\u003e\n\t\u003cimg src=\"\u003c%= file.url %\u003e\" title=\"\u003c%= file.title or file.name %\u003e\" /\u003e\n\u003c/p\u003e\n\u003c% end %\u003e\n```\n\n\u003c!-- HISTORY/ --\u003e\n\n\u003ch2\u003eHistory\u003c/h2\u003e\n\n\u003ca href=\"https://github.com/docpad/docpad-plugin-associatedfiles/blob/master/HISTORY.md#files\"\u003eDiscover the release history by heading on over to the \u003ccode\u003eHISTORY.md\u003c/code\u003e file.\u003c/a\u003e\n\n\u003c!-- /HISTORY --\u003e\n\n\n\u003c!-- CONTRIBUTE/ --\u003e\n\n\u003ch2\u003eContribute\u003c/h2\u003e\n\n\u003ca href=\"https://github.com/docpad/docpad-plugin-associatedfiles/blob/master/CONTRIBUTING.md#files\"\u003eDiscover how you can contribute by heading on over to the \u003ccode\u003eCONTRIBUTING.md\u003c/code\u003e file.\u003c/a\u003e\n\n\u003c!-- /CONTRIBUTE --\u003e\n\n\n\u003c!-- BACKERS/ --\u003e\n\n\u003ch2\u003eBackers\u003c/h2\u003e\n\n\u003ch3\u003eMaintainers\u003c/h3\u003e\n\nThese amazing people are maintaining this project:\n\n\u003cul\u003e\u003cli\u003e\u003ca href=\"https://github.com/balupton\"\u003eBenjamin Lupton\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-associatedfiles/commits?author=balupton\" title=\"View the GitHub contributions of Benjamin Lupton on repository docpad/docpad-plugin-associatedfiles\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\n\u003ch3\u003eSponsors\u003c/h3\u003e\n\nNo sponsors yet! Will you be the first?\n\n\u003cspan class=\"badge-githubsponsors\"\u003e\u003ca href=\"https://github.com/sponsors/balupton\" title=\"Donate to this project using GitHub Sponsors\"\u003e\u003cimg src=\"https://img.shields.io/badge/github-donate-yellow.svg\" alt=\"GitHub Sponsors donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-patreon\"\u003e\u003ca href=\"https://patreon.com/bevry\" title=\"Donate to this project using Patreon\"\u003e\u003cimg src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-flattr\"\u003e\u003ca href=\"https://flattr.com/profile/balupton\" title=\"Donate to this project using Flattr\"\u003e\u003cimg src=\"https://img.shields.io/badge/flattr-donate-yellow.svg\" alt=\"Flattr donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-liberapay\"\u003e\u003ca href=\"https://liberapay.com/bevry\" title=\"Donate to this project using Liberapay\"\u003e\u003cimg src=\"https://img.shields.io/badge/liberapay-donate-yellow.svg\" alt=\"Liberapay donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-buymeacoffee\"\u003e\u003ca href=\"https://buymeacoffee.com/balupton\" title=\"Donate to this project using Buy Me A Coffee\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg\" alt=\"Buy Me A Coffee donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-opencollective\"\u003e\u003ca href=\"https://opencollective.com/bevry\" title=\"Donate to this project using Open Collective\"\u003e\u003cimg src=\"https://img.shields.io/badge/open%20collective-donate-yellow.svg\" alt=\"Open Collective donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-crypto\"\u003e\u003ca href=\"https://bevry.me/crypto\" title=\"Donate to this project using Cryptocurrency\"\u003e\u003cimg src=\"https://img.shields.io/badge/crypto-donate-yellow.svg\" alt=\"crypto donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-paypal\"\u003e\u003ca href=\"https://bevry.me/paypal\" title=\"Donate to this project using Paypal\"\u003e\u003cimg src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-wishlist\"\u003e\u003ca href=\"https://bevry.me/wishlist\" title=\"Buy an item on our wishlist for us\"\u003e\u003cimg src=\"https://img.shields.io/badge/wishlist-donate-yellow.svg\" alt=\"Wishlist browse button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\n\u003ch3\u003eContributors\u003c/h3\u003e\n\nThese amazing people have contributed code to this project:\n\n\u003cul\u003e\u003cli\u003e\u003ca href=\"https://github.com/balupton\"\u003eBenjamin Lupton\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-associatedfiles/commits?author=balupton\" title=\"View the GitHub contributions of Benjamin Lupton on repository docpad/docpad-plugin-associatedfiles\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://takitapart.com\"\u003eBob VanderClay\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/bobvanderclay\"\u003eBob VanderClay\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-associatedfiles/commits?author=bobvanderclay\" title=\"View the GitHub contributions of Bob VanderClay on repository docpad/docpad-plugin-associatedfiles\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/jonathanh32\"\u003eJonathan Hughes\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-associatedfiles/commits?author=jonathanh32\" title=\"View the GitHub contributions of Jonathan Hughes on repository docpad/docpad-plugin-associatedfiles\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/msutherl\"\u003eMorgan Sutherland\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-associatedfiles/commits?author=msutherl\" title=\"View the GitHub contributions of Morgan Sutherland on repository docpad/docpad-plugin-associatedfiles\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/RobLoach\"\u003eRob Loach\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-associatedfiles/commits?author=RobLoach\" title=\"View the GitHub contributions of Rob Loach on repository docpad/docpad-plugin-associatedfiles\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\n\u003ca href=\"https://github.com/docpad/docpad-plugin-associatedfiles/blob/master/CONTRIBUTING.md#files\"\u003eDiscover how you can contribute by heading on over to the \u003ccode\u003eCONTRIBUTING.md\u003c/code\u003e file.\u003c/a\u003e\n\n\u003c!-- /BACKERS --\u003e\n\n\n\u003c!-- LICENSE/ --\u003e\n\n\u003ch2\u003eLicense\u003c/h2\u003e\n\nUnless stated otherwise all works are:\n\n\u003cul\u003e\u003cli\u003eCopyright \u0026copy; \u003ca href=\"http://bevry.me\"\u003eBevry Pty Ltd\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\nand licensed under:\n\n\u003cul\u003e\u003cli\u003e\u003ca href=\"http://spdx.org/licenses/MIT.html\"\u003eMIT License\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\n\u003c!-- /LICENSE --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocpad%2Fdocpad-plugin-associatedfiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocpad%2Fdocpad-plugin-associatedfiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocpad%2Fdocpad-plugin-associatedfiles/lists"}