{"payload":{"allShortcutsEnabled":false,"fileTree":{"templates/pages/docs":{"items":[{"name":"drafts","path":"templates/pages/docs/drafts","contentType":"directory"},{"name":"sections","path":"templates/pages/docs/sections","contentType":"directory"},{"name":"About.md.hbs","path":"templates/pages/docs/About.md.hbs","contentType":"file"},{"name":"Announcements.md.hbs","path":"templates/pages/docs/Announcements.md.hbs","contentType":"file"},{"name":"Built-in-Variables.md.hbs","path":"templates/pages/docs/Built-in-Variables.md.hbs","contentType":"file"},{"name":"Cheatsheet-Handlebars.md.hbs","path":"templates/pages/docs/Cheatsheet-Handlebars.md.hbs","contentType":"file"},{"name":"Cheatsheet-Lo-Dash.md.hbs","path":"templates/pages/docs/Cheatsheet-Lo-Dash.md.hbs","contentType":"file"},{"name":"Cheatsheet-Markdown.md.hbs","path":"templates/pages/docs/Cheatsheet-Markdown.md.hbs","contentType":"file"},{"name":"Collections.md.hbs","path":"templates/pages/docs/Collections.md.hbs","contentType":"file"},{"name":"Comparison.md.hbs","path":"templates/pages/docs/Comparison.md.hbs","contentType":"file"},{"name":"Content.md.hbs","path":"templates/pages/docs/Content.md.hbs","contentType":"file"},{"name":"Context.md.hbs","path":"templates/pages/docs/Context.md.hbs","contentType":"file"},{"name":"Contributors.md.hbs","path":"templates/pages/docs/Contributors.md.hbs","contentType":"file"},{"name":"Custom-Helpers.md.hbs","path":"templates/pages/docs/Custom-Helpers.md.hbs","contentType":"file"},{"name":"Data.md.hbs","path":"templates/pages/docs/Data.md.hbs","contentType":"file"},{"name":"Embedding-Code.md.hbs","path":"templates/pages/docs/Embedding-Code.md.hbs","contentType":"file"},{"name":"Errors.md.hbs","path":"templates/pages/docs/Errors.md.hbs","contentType":"file"},{"name":"External-Libraries.md.hbs","path":"templates/pages/docs/External-Libraries.md.hbs","contentType":"file"},{"name":"FAQ.md.hbs","path":"templates/pages/docs/FAQ.md.hbs","contentType":"file"},{"name":"Grapevine.md.hbs","path":"templates/pages/docs/Grapevine.md.hbs","contentType":"file"},{"name":"Helpers.md.hbs","path":"templates/pages/docs/Helpers.md.hbs","contentType":"file"},{"name":"Home.md.hbs","path":"templates/pages/docs/Home.md.hbs","contentType":"file"},{"name":"Idiomatic-Data.md.hbs","path":"templates/pages/docs/Idiomatic-Data.md.hbs","contentType":"file"},{"name":"Idiomatic-Templates.md.hbs","path":"templates/pages/docs/Idiomatic-Templates.md.hbs","contentType":"file"},{"name":"Installation.md.hbs","path":"templates/pages/docs/Installation.md.hbs","contentType":"file"},{"name":"Introduction.md.hbs","path":"templates/pages/docs/Introduction.md.hbs","contentType":"file"},{"name":"JSON.md.hbs","path":"templates/pages/docs/JSON.md.hbs","contentType":"file"},{"name":"Layouts.md.hbs","path":"templates/pages/docs/Layouts.md.hbs","contentType":"file"},{"name":"Markdown-Styling.md.hbs","path":"templates/pages/docs/Markdown-Styling.md.hbs","contentType":"file"},{"name":"Markdown.md.hbs","path":"templates/pages/docs/Markdown.md.hbs","contentType":"file"},{"name":"Metadata.md.hbs","path":"templates/pages/docs/Metadata.md.hbs","contentType":"file"},{"name":"Methods.md.hbs","path":"templates/pages/docs/Methods.md.hbs","contentType":"file"},{"name":"Methods2.md.hbs","path":"templates/pages/docs/Methods2.md.hbs","contentType":"file"},{"name":"Options.md.hbs","path":"templates/pages/docs/Options.md.hbs","contentType":"file"},{"name":"Outline.md.hbs","path":"templates/pages/docs/Outline.md.hbs","contentType":"file"},{"name":"Overview.md.hbs","path":"templates/pages/docs/Overview.md.hbs","contentType":"file"},{"name":"Pages-Arrays.md.hbs","path":"templates/pages/docs/Pages-Arrays.md.hbs","contentType":"file"},{"name":"Pages-Collections.md.hbs","path":"templates/pages/docs/Pages-Collections.md.hbs","contentType":"file"},{"name":"Pages.md.hbs","path":"templates/pages/docs/Pages.md.hbs","contentType":"file"},{"name":"Partials.md.hbs","path":"templates/pages/docs/Partials.md.hbs","contentType":"file"},{"name":"Quickstart.md.hbs","path":"templates/pages/docs/Quickstart.md.hbs","contentType":"file"},{"name":"Resources.md.hbs","path":"templates/pages/docs/Resources.md.hbs","contentType":"file"},{"name":"Snippets.md.hbs","path":"templates/pages/docs/Snippets.md.hbs","contentType":"file"},{"name":"Support.md.hbs","path":"templates/pages/docs/Support.md.hbs","contentType":"file"},{"name":"Templates-Overview.md.hbs","path":"templates/pages/docs/Templates-Overview.md.hbs","contentType":"file"},{"name":"Underscore-Mixins.md.hbs","path":"templates/pages/docs/Underscore-Mixins.md.hbs","contentType":"file"},{"name":"Who-Uses-Assemble.md.hbs","path":"templates/pages/docs/Who-Uses-Assemble.md.hbs","contentType":"file"},{"name":"Why-Assemble.md.hbs","path":"templates/pages/docs/Why-Assemble.md.hbs","contentType":"file"},{"name":"Workflows.md.hbs","path":"templates/pages/docs/Workflows.md.hbs","contentType":"file"},{"name":"YAML-front-matter.md.hbs","path":"templates/pages/docs/YAML-front-matter.md.hbs","contentType":"file"},{"name":"YAML.md.hbs","path":"templates/pages/docs/YAML.md.hbs","contentType":"file"},{"name":"index.hbs","path":"templates/pages/docs/index.hbs","contentType":"file"},{"name":"layouts.json","path":"templates/pages/docs/layouts.json","contentType":"file"},{"name":"options-assets.md.hbs","path":"templates/pages/docs/options-assets.md.hbs","contentType":"file"},{"name":"options-collections.md.hbs","path":"templates/pages/docs/options-collections.md.hbs","contentType":"file"},{"name":"options-data.md.hbs","path":"templates/pages/docs/options-data.md.hbs","contentType":"file"},{"name":"options-engine.md.hbs","path":"templates/pages/docs/options-engine.md.hbs","contentType":"file"},{"name":"options-ext.md.hbs","path":"templates/pages/docs/options-ext.md.hbs","contentType":"file"},{"name":"options-helpers.md.hbs","path":"templates/pages/docs/options-helpers.md.hbs","contentType":"file"},{"name":"options-layout.md.hbs","path":"templates/pages/docs/options-layout.md.hbs","contentType":"file"},{"name":"options-layoutdir.md.hbs","path":"templates/pages/docs/options-layoutdir.md.hbs","contentType":"file"},{"name":"options-layouts.md.hbs","path":"templates/pages/docs/options-layouts.md.hbs","contentType":"file"},{"name":"options-marked.md.hbs","path":"templates/pages/docs/options-marked.md.hbs","contentType":"file"},{"name":"options-pages.md.hbs","path":"templates/pages/docs/options-pages.md.hbs","contentType":"file"},{"name":"options-pagination.md.hbs","path":"templates/pages/docs/options-pagination.md.hbs","contentType":"file"},{"name":"options-partials.md.hbs","path":"templates/pages/docs/options-partials.md.hbs","contentType":"file"},{"name":"options-permalinks.md.hbs","path":"templates/pages/docs/options-permalinks.md.hbs","contentType":"file"}],"totalCount":67},"templates/pages":{"items":[{"name":"blog","path":"templates/pages/blog","contentType":"directory"},{"name":"boilerplates","path":"templates/pages/boilerplates","contentType":"directory"},{"name":"contributing","path":"templates/pages/contributing","contentType":"directory"},{"name":"docs","path":"templates/pages/docs","contentType":"directory"},{"name":"examples","path":"templates/pages/examples","contentType":"directory"},{"name":"extensions","path":"templates/pages/extensions","contentType":"directory"},{"name":"helpers","path":"templates/pages/helpers","contentType":"directory"},{"name":"plugins","path":"templates/pages/plugins","contentType":"directory"},{"name":"tutorials","path":"templates/pages/tutorials","contentType":"directory"},{"name":"examples.hbs","path":"templates/pages/examples.hbs","contentType":"file"},{"name":"helpers.json","path":"templates/pages/helpers.json","contentType":"file"},{"name":"index.hbs","path":"templates/pages/index.hbs","contentType":"file"}],"totalCount":12},"templates":{"items":[{"name":"includes","path":"templates/includes","contentType":"directory"},{"name":"layouts","path":"templates/layouts","contentType":"directory"},{"name":"pages","path":"templates/pages","contentType":"directory"}],"totalCount":3},"":{"items":[{"name":"src","path":"src","contentType":"directory"},{"name":"templates","path":"templates","contentType":"directory"},{"name":".assemblerc","path":".assemblerc","contentType":"file"},{"name":".bowerrc","path":".bowerrc","contentType":"file"},{"name":".gitattributes","path":".gitattributes","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".travis.yml","path":".travis.yml","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"Gruntfile.js","path":"Gruntfile.js","contentType":"file"},{"name":"LICENSE-MIT","path":"LICENSE-MIT","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"bower.json","path":"bower.json","contentType":"file"},{"name":"package.json","path":"package.json","contentType":"file"}],"totalCount":13}},"fileTreeProcessingTime":22.833123,"foldersToFetch":[],"repo":{"id":10907540,"defaultBranch":"gh-pages","name":"assemble.io","ownerLogin":"assemble","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2013-06-24T12:27:47.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/2645080?v=4","public":true,"private":false,"isOrgOwned":true},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1461093700.0","canEdit":false,"refType":"branch","currentOid":"0d197caaf8863f7f0eb1744c8230b6e068353dfa"},"path":"templates/pages/docs/options-data.md.hbs","currentUser":null,"blob":{"rawLines":["---","title: options.data","","area: docs","section: configuration","categories:","- options","tags:","- data","- yaml","- json","- yfm","---","","","### Also see [data types][data] →","","{{#draft}}","","## Usages Examples","","* Pass configuration data to Grunt/Assemble","* Pass metadata to templates","* Pass content to files","{{/draft}}","","","## Supplying data to templates","","You must first define the paths to any data files you wish to use via the `options.data` object in the `assemble` task or target, then Assemble will automatically supply data to your templates:","","```js","assemble: {"," options: {"," data: 'src/data/*.json'"," },"," files: {"," 'site/': ['src/pages/*.hbs']"," }","}","```","","### Matching names","","When using \"external\" data files (versus YAML front matter), _if name of the data file is the same as the associated template_ then Assemble will automatically associate the two files.","","**\"widget component\" example**","","Given a data file, such as `widget.json` or `widget.yml` :","","```json","{"," \"name\": \"This is a square widget\","," \"modifier\": \"widget-square\"","}","```","","With the following Handlebars expressions in out template, `widget.hbs`:","","```html","
","```","","The result after running `grunt assemble` will be:","","```html"," ","```","","**package.json example #1**","","Add `package.json` to the `data` object:","","```js","assemble: {"," myProject: {"," options: {"," data: 'package.json'"," },"," files: {"," 'dest': ['src/templates/**/*.hbs']"," }"," }","}","```","","And we will now be able to retrieve metadata from `package.json` by using variables such as:","","* `\\{{package.verson}}`","* `\\{{package.name}}`","* `\\{{package.description}}`","* `\\{{package.author.url}}`","* `\\{{package.author.name}}`","","","","**package.json example #2**","","Assuming we add the following code to our Gruntfile","","```js","pkg: grunt.file.readJSON('package.json'),","","assemble: {"," myProject: {"," options: {"," pkg: '<%= pkg %>',"," data: 'other/data/*.json'"," },"," files: {"," 'dest': ['src/templates/**/*.hbs']"," }"," }","}","```","","We can now use the following variables in our templates:","","* `\\{{pkg.verson}}`","* `\\{{pkg.name}}`","* `\\{{pkg.description}}`","* `\\{{pkg.author.url}}`","* `\\{{pkg.author.name}}`","","","> Also see: [YAML front matter][yaml-front-matter]","","","## Related Info","","* [Complete list of Options][Options]","* [Data Types][data]","* [variables][built-in-variables]"],"stylingDirectives":[[{"start":0,"end":3,"cssClass":"pl-c1"}],[{"start":0,"end":19,"cssClass":"pl-c1"},{"start":0,"end":5,"cssClass":"pl-ent"},{"start":7,"end":19,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-c1"}],[{"start":0,"end":10,"cssClass":"pl-c1"},{"start":0,"end":4,"cssClass":"pl-ent"},{"start":6,"end":10,"cssClass":"pl-s"}],[{"start":0,"end":22,"cssClass":"pl-c1"},{"start":0,"end":7,"cssClass":"pl-ent"},{"start":9,"end":22,"cssClass":"pl-s"}],[{"start":0,"end":11,"cssClass":"pl-c1"},{"start":0,"end":10,"cssClass":"pl-ent"}],[{"start":0,"end":9,"cssClass":"pl-c1"},{"start":2,"end":9,"cssClass":"pl-s"}],[{"start":0,"end":5,"cssClass":"pl-c1"},{"start":0,"end":4,"cssClass":"pl-ent"}],[{"start":0,"end":6,"cssClass":"pl-c1"},{"start":2,"end":6,"cssClass":"pl-s"}],[{"start":0,"end":6,"cssClass":"pl-c1"},{"start":2,"end":6,"cssClass":"pl-s"}],[{"start":0,"end":6,"cssClass":"pl-c1"},{"start":2,"end":6,"cssClass":"pl-s"}],[{"start":0,"end":5,"cssClass":"pl-c1"},{"start":2,"end":5,"cssClass":"pl-s"}],[{"start":0,"end":3,"cssClass":"pl-c1"}],[],[],[],[],[{"start":0,"end":2,"cssClass":"pl-c1"},{"start":2,"end":8,"cssClass":"pl-c1"},{"start":8,"end":10,"cssClass":"pl-c1"}],[],[],[],[],[],[],[{"start":0,"end":2,"cssClass":"pl-c1"},{"start":2,"end":8,"cssClass":"pl-c1"},{"start":8,"end":10,"cssClass":"pl-c1"}],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[{"start":1,"end":4,"cssClass":"pl-ent"},{"start":5,"end":11,"cssClass":"pl-e"},{"start":5,"end":10,"cssClass":"pl-e"},{"start":11,"end":42,"cssClass":"pl-s"},{"start":11,"end":12,"cssClass":"pl-pds"},{"start":20,"end":22,"cssClass":"pl-c1"},{"start":23,"end":38,"cssClass":"pl-v"},{"start":39,"end":41,"cssClass":"pl-c1"},{"start":41,"end":42,"cssClass":"pl-pds"},{"start":44,"end":46,"cssClass":"pl-c1"},{"start":47,"end":58,"cssClass":"pl-v"},{"start":59,"end":61,"cssClass":"pl-c1"},{"start":63,"end":66,"cssClass":"pl-ent"}],[],[],[],[],[],[{"start":1,"end":4,"cssClass":"pl-ent"},{"start":5,"end":11,"cssClass":"pl-e"},{"start":5,"end":10,"cssClass":"pl-e"},{"start":11,"end":33,"cssClass":"pl-s"},{"start":11,"end":12,"cssClass":"pl-pds"},{"start":32,"end":33,"cssClass":"pl-pds"},{"start":59,"end":62,"cssClass":"pl-ent"}],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[{"start":4,"end":6,"cssClass":"pl-c1"},{"start":6,"end":20,"cssClass":"pl-v"},{"start":20,"end":22,"cssClass":"pl-c1"}],[{"start":4,"end":6,"cssClass":"pl-c1"},{"start":6,"end":18,"cssClass":"pl-v"},{"start":18,"end":20,"cssClass":"pl-c1"}],[{"start":4,"end":6,"cssClass":"pl-c1"},{"start":6,"end":25,"cssClass":"pl-v"},{"start":25,"end":27,"cssClass":"pl-c1"}],[{"start":4,"end":6,"cssClass":"pl-c1"},{"start":6,"end":24,"cssClass":"pl-v"},{"start":24,"end":26,"cssClass":"pl-c1"}],[{"start":4,"end":6,"cssClass":"pl-c1"},{"start":6,"end":25,"cssClass":"pl-v"},{"start":25,"end":27,"cssClass":"pl-c1"}],[],[],[],[],[],[],[],[],[],[],[],[],[],[{"start":12,"end":13,"cssClass":"pl-ii"}],[],[],[],[],[],[],[],[],[],[],[],[{"start":4,"end":6,"cssClass":"pl-c1"},{"start":6,"end":16,"cssClass":"pl-v"},{"start":16,"end":18,"cssClass":"pl-c1"}],[{"start":4,"end":6,"cssClass":"pl-c1"},{"start":6,"end":14,"cssClass":"pl-v"},{"start":14,"end":16,"cssClass":"pl-c1"}],[{"start":4,"end":6,"cssClass":"pl-c1"},{"start":6,"end":21,"cssClass":"pl-v"},{"start":21,"end":23,"cssClass":"pl-c1"}],[{"start":4,"end":6,"cssClass":"pl-c1"},{"start":6,"end":20,"cssClass":"pl-v"},{"start":20,"end":22,"cssClass":"pl-c1"}],[{"start":4,"end":6,"cssClass":"pl-c1"},{"start":6,"end":21,"cssClass":"pl-v"},{"start":21,"end":23,"cssClass":"pl-c1"}],[],[],[],[],[],[],[],[],[],[],[]],"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/assemble/assemble.io/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"options-data.md.hbs","displayUrl":"https://github.com/assemble/assemble.io/blob/master/templates/pages/docs/options-data.md.hbs?raw=true","headerInfo":{"blobSize":"2.35 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"153dea8","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fassemble%2Fassemble.io%2Fblob%2Fmaster%2Ftemplates%2Fpages%2Fdocs%2Foptions-data.md.hbs","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"134","truncatedSloc":"96"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Handlebars","languageID":155,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/assemble/assemble.io/blob/master/templates/pages/docs/options-data.md.hbs","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/assemble/assemble.io/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/assemble/assemble.io/raw/master/templates/pages/docs/options-data.md.hbs","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":"/assemble/.github/blob/bad573f437f7f5d29d3786b98310cb7f8de033a2/funding.yml","showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":true,"symbols":[]}},"copilotInfo":null,"copilotAccessAllowed":false,"csrf_tokens":{"/assemble/assemble.io/branches":{"post":"tNbFmB94SvienA3kzEXWlufmpfzRVbYf2PL-RsqakfqdMxqDmIqfME2-H_Gg9IKlfDQB8TkGanPhLn4a6o2_Zw"},"/repos/preferences":{"post":"-pDkXw6M-f5i9BqFQqPwZ-q5_dXzBP4ciMHJEHR1OM240UsLH8QiFRrfimvMtKVJez5QmyDzFpwv9uEHd972AQ"}}},"title":"assemble.io/templates/pages/docs/options-data.md.hbs at master · assemble/assemble.io"}