{"id":19091667,"url":"https://github.com/helpers/helper-link-to","last_synced_at":"2025-04-30T11:50:59.970Z","repository":{"id":57262704,"uuid":"49795178","full_name":"helpers/helper-link-to","owner":"helpers","description":"Templates helper that returns a link path from the current view to the another view.","archived":false,"fork":false,"pushed_at":"2017-04-13T02:13:14.000Z","size":28,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-30T15:51:12.728Z","etag":null,"topics":["helper","link","relative","resolve","template"],"latest_commit_sha":null,"homepage":null,"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/helpers.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":"2016-01-16T23:23:56.000Z","updated_at":"2021-01-14T15:52:26.000Z","dependencies_parsed_at":"2022-09-01T06:30:58.614Z","dependency_job_id":null,"html_url":"https://github.com/helpers/helper-link-to","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/helpers%2Fhelper-link-to","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpers%2Fhelper-link-to/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpers%2Fhelper-link-to/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpers%2Fhelper-link-to/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helpers","download_url":"https://codeload.github.com/helpers/helper-link-to/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249186206,"owners_count":21226698,"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":["helper","link","relative","resolve","template"],"created_at":"2024-11-09T03:16:32.280Z","updated_at":"2025-04-18T13:33:58.963Z","avatar_url":"https://github.com/helpers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# helper-link-to [![NPM version](https://img.shields.io/npm/v/helper-link-to.svg?style=flat)](https://www.npmjs.com/package/helper-link-to) [![NPM monthly downloads](https://img.shields.io/npm/dm/helper-link-to.svg?style=flat)](https://npmjs.org/package/helper-link-to) [![Linux Build Status](https://img.shields.io/travis/helpers/helper-link-to.svg?style=flat\u0026label=Travis)](https://travis-ci.org/helpers/helper-link-to)\n\n\u003e Templates helper that returns a link path from the current view to the another view.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save helper-link-to\n```\n\n## Usage\n\nThis helper should be used with an `app` created with [templates](https://github.com/jonschlinkert/templates) or something that inherits from [templates](https://github.com/jonschlinkert/templates). See [related projects](#related-projects) for some apps that use [templates](https://github.com/jonschlinkert/templates)\n\n### With [assemble](https://github.com/assemble/assemble) and [engine-handlebars](https://github.com/jonschlinkert/engine-handlebars)\n\nSetup the helper by registering it with the app:\n\n```js\n// assemble is a descendant of `templates`\nvar app = assemble();\napp.engine('hbs', require('engine-handlebars'));\n\n// engines like handlebars can handle a helper name with dashes\napp.helper('link-to', require('helper-link-to'));\n```\nUse the helper in a handlebars template:\n\n```hbs\n\u003ca href=\"{{link-to 'about'}}\"\u003eAbout\u003c/a\u003e\n```\n\nCreates output like:\n\n```html\n\u003ca href=\"./about.html\"\u003eAbout\u003c/a\u003e\n```\n\n### With [verb](https://github.com/verbose/verb) and [engine-base](https://github.com/jonschlinkert/engine-base)\n\nSetup the helper by registering it with the app:\n\n```js\n// verb is a descendant of `templates`\nvar app = verb();\napp.engine('md', require('engine-base'));\n\n// engines like `engine-base` cannot handle a helper name with dashes\napp.helper('linkTo', require('helper-link-to'));\n```\nUse the helper in a template:\n\n```md\n - [Getting Started][{%= linkTo(\"getting-started\", \"docs\") %}]\n```\nCreates output like:\n\n```md\n - [Getting Started][docs/getting-started.md]\n```\n\n## API\n\n### [linkTo](index.js#L32)\n\n[templates](https://github.com/jonschlinkert/templates) helper that creates a link from the current view to the specified view on the specified collection.\n\n**Params**\n\n* `key` **{String|Object}**: Name of the view to lookup to link to. May also pass in a view instance link to.\n* `name` **{String}**: (optional) Name of the collection to search for the view. (default=\"pages\")\n* `props` **{Array}**: Optional array of properties to check when getting the destination path from a view. May use dot notication (data.permalink). (default=[\"data.path\", \"dest\", \"path\"])\n* `returns` **{String}**: Relative path to the specified view from the current view.\n\n**Example**\n\n```hbs\n{{! Handlebars example linking from \"home.html\" to \"about.html\" in the default \"pages\" collection }}\n\u003ca href=\"{{link-to 'about'}}\"\u003eAbout\u003c/a\u003e\n\n\u003c!-- Handlebars example linking from \"home.html\" to \"blog/post-1.html\" in the \"posts\" collection --\u003e\n\u003ca href=\"{{link-to 'post-1' 'posts'}}\"\u003ePost 1\u003c/a\u003e\n```\n\n## About\n\n### Related projects\n\n* [assemble-core](https://www.npmjs.com/package/assemble-core): The core assemble application with no presets or defaults. All configuration is left to the… [more](https://github.com/assemble/assemble-core) | [homepage](https://github.com/assemble/assemble-core \"The core assemble application with no presets or defaults. All configuration is left to the implementor.\")\n* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble \"Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit\")\n* [engine-base](https://www.npmjs.com/package/engine-base): Default engine for Template. | [homepage](https://github.com/jonschlinkert/engine-base \"Default engine for Template.\")\n* [engine-handlebars](https://www.npmjs.com/package/engine-handlebars): Handlebars engine, consolidate.js style but with enhancements. This works with Assemble, express.js, engine-cache or any… [more](https://github.com/jonschlinkert/engine-handlebars) | [homepage](https://github.com/jonschlinkert/engine-handlebars \"Handlebars engine, consolidate.js style but with enhancements. This works with Assemble, express.js, engine-cache or any application that follows consolidate.js conventions.\")\n* [generate](https://www.npmjs.com/package/generate): Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the… [more](https://github.com/generate/generate) | [homepage](https://github.com/generate/generate \"Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either.\")\n* [handlebars](https://www.npmjs.com/package/handlebars): Handlebars provides the power necessary to let you build semantic templates effectively with no frustration | [homepage](http://www.handlebarsjs.com/ \"Handlebars provides the power necessary to let you build semantic templates effectively with no frustration\")\n* [relative-dest](https://www.npmjs.com/package/relative-dest): Calculate the relative path from a file's destination path to another directory or file. | [homepage](https://github.com/jonschlinkert/relative-dest \"Calculate the relative path from a file's destination path to another directory or file.\")\n* [relative](https://www.npmjs.com/package/relative): Get the relative filepath from path A to path B. Calculates from file-to-directory, file-to-file, directory-to-file… [more](https://github.com/jonschlinkert/relative) | [homepage](https://github.com/jonschlinkert/relative \"Get the relative filepath from path A to path B. Calculates from file-to-directory, file-to-file, directory-to-file, and directory-to-directory.\")\n* [templates](https://www.npmjs.com/package/templates): System for creating and managing template collections, and rendering templates with any node.js template engine… [more](https://github.com/jonschlinkert/templates) | [homepage](https://github.com/jonschlinkert/templates \"System for creating and managing template collections, and rendering templates with any node.js template engine. Can be used as the basis for creating a static site generator or blog framework.\")\n* [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update \"Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.\")\n* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb \"Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 36 | [doowb](https://github.com/doowb) |\n| 8 | [jonschlinkert](https://github.com/jonschlinkert) |\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Brian Woodward**\n\n* [github/doowb](https://github.com/doowb)\n* [twitter/doowb](https://twitter.com/doowb)\n\n### License\n\nCopyright © 2017, [Brian Woodward](https://github.com/doowb).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 12, 2017._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpers%2Fhelper-link-to","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelpers%2Fhelper-link-to","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpers%2Fhelper-link-to/lists"}