{"action":"created","issue":{"url":"https://api.github.com/repos/jekyll/jekyll/issues/3723","labels_url":"https://api.github.com/repos/jekyll/jekyll/issues/3723/labels{/name}","comments_url":"https://api.github.com/repos/jekyll/jekyll/issues/3723/comments","events_url":"https://api.github.com/repos/jekyll/jekyll/issues/3723/events","html_url":"https://github.com/jekyll/jekyll/pull/3723","id":79309901,"number":3723,"title":"Collection relative paths","user":{"login":"mathematicalcoffee","id":1459546,"avatar_url":"https://avatars.githubusercontent.com/u/1459546?v=3","gravatar_id":"","url":"https://api.github.com/users/mathematicalcoffee","html_url":"https://github.com/mathematicalcoffee","followers_url":"https://api.github.com/users/mathematicalcoffee/followers","following_url":"https://api.github.com/users/mathematicalcoffee/following{/other_user}","gists_url":"https://api.github.com/users/mathematicalcoffee/gists{/gist_id}","starred_url":"https://api.github.com/users/mathematicalcoffee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathematicalcoffee/subscriptions","organizations_url":"https://api.github.com/users/mathematicalcoffee/orgs","repos_url":"https://api.github.com/users/mathematicalcoffee/repos","events_url":"https://api.github.com/users/mathematicalcoffee/events{/privacy}","received_events_url":"https://api.github.com/users/mathematicalcoffee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-22T06:10:06Z","updated_at":"2015-06-19T03:09:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jekyll/jekyll/pulls/3723","html_url":"https://github.com/jekyll/jekyll/pull/3723","diff_url":"https://github.com/jekyll/jekyll/pull/3723.diff","patch_url":"https://github.com/jekyll/jekyll/pull/3723.patch"},"body":"Addressing [this issue](https://github.com/jekyll/jekyll/issues/2518). #2518 \r\n\r\n**Aim:** allow the directory that a collection is in to be different to `<source>/_<collection name>`.\r\n\r\n**Reason:** e.g. for cleanliness of the top-level directory - we could have `_collections/` and list all of our collections under there.\r\n\r\n**Achieved by:** allow the user to set the `relative_directory` property of a collection in `_config.yml` with the path to the collection's directory.\r\n\r\nFor example:\r\n\r\n**Example:**\r\n\r\nSuppose I had a collection `my_collection`. Before this patch, it would have to be in `<source_directory>/_my_collection`. Suppose now I move it to `_collections/stupid_name`.\r\n\r\nIn `_config.yml`, just add `relative_directory` to `my_collection`'s metadata:\r\n\r\n```\r\ncollections:\r\n  my_collection:\r\n    relative_directory: _collections/stupid_name\r\n```\r\n\r\nThe resulting collection:\r\n\r\n* has label `my_collection` (**regardless** of the name of the actual directory name, `stupid_name` in this case - though in practice you'd keep the name of the directory the same as the name of the collection).\r\n* is copied to `<dest>/<collection name>/`\r\n* each document in the collection has `path` property `_collections/stupid_name/index.md`, rather than `_my_collection/index.md`. This is the only thing I might think of as being inconsistent.\r\n\r\n**Questions**\r\n\r\nAre the tests rigorous enough? And what about behaviour re: the last point?\r\n\r\nNote - in the 'master' version of jekyll this `path` property would be the absolute path to the (source) file, e.g. `/home/amy/sandbox/jekyllsite/_my_collection/index.md`. In this PR it changes to the relative path `_collections/stupid_name/index.md`.\r\n\r\nThe jekyll documentation says `path` should be \r\n> Path to the document relative to the collection's directory.\r\n\r\nAccording to this, the `path` property should really be `index.md` (being relative to the collection directory), so both the current jekyll and this PR jekyll are getting it wrong - the former gives an *absolute* path, and the later gives a relative path, but to the site's directory (not the collection's directory).\r\n\r\nBut perhaps that should be a separate issue (whereby either the docs are updated or the meaning of `path` is made clear), particularly as changing `path` would probably break many people's sites."},"comment":{"url":"https://api.github.com/repos/jekyll/jekyll/issues/comments/113355044","html_url":"https://github.com/jekyll/jekyll/pull/3723#issuecomment-113355044","issue_url":"https://api.github.com/repos/jekyll/jekyll/issues/3723","id":113355044,"user":{"login":"envygeeks","id":99763,"avatar_url":"https://avatars.githubusercontent.com/u/99763?v=3","gravatar_id":"","url":"https://api.github.com/users/envygeeks","html_url":"https://github.com/envygeeks","followers_url":"https://api.github.com/users/envygeeks/followers","following_url":"https://api.github.com/users/envygeeks/following{/other_user}","gists_url":"https://api.github.com/users/envygeeks/gists{/gist_id}","starred_url":"https://api.github.com/users/envygeeks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/envygeeks/subscriptions","organizations_url":"https://api.github.com/users/envygeeks/orgs","repos_url":"https://api.github.com/users/envygeeks/repos","events_url":"https://api.github.com/users/envygeeks/events{/privacy}","received_events_url":"https://api.github.com/users/envygeeks/received_events","type":"User","site_admin":false},"created_at":"2015-06-19T03:09:46Z","updated_at":"2015-06-19T03:09:46Z","body":"That's is definitely something not done in the source thus far, I'm going to ping @mathematicalcoffee and ask that a test + alteration be made to the variable that it accepts and use `Jekyll.sanitized_path` on the result before allowing it to be put into a variable that's cached.  This should suffice to suite what @mattr- wants."}}