{"action":"created","issue":{"url":"https://api.github.com/repos/assemble/assemble/issues/555","labels_url":"https://api.github.com/repos/assemble/assemble/issues/555/labels{/name}","comments_url":"https://api.github.com/repos/assemble/assemble/issues/555/comments","events_url":"https://api.github.com/repos/assemble/assemble/issues/555/events","html_url":"https://github.com/assemble/assemble/issues/555","id":39723244,"number":555,"title":"Improve the layout system","user":{"login":"almeidap","id":46221,"avatar_url":"https://avatars.githubusercontent.com/u/46221?v=3","gravatar_id":"","url":"https://api.github.com/users/almeidap","html_url":"https://github.com/almeidap","followers_url":"https://api.github.com/users/almeidap/followers","following_url":"https://api.github.com/users/almeidap/following{/other_user}","gists_url":"https://api.github.com/users/almeidap/gists{/gist_id}","starred_url":"https://api.github.com/users/almeidap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almeidap/subscriptions","organizations_url":"https://api.github.com/users/almeidap/orgs","repos_url":"https://api.github.com/users/almeidap/repos","events_url":"https://api.github.com/users/almeidap/events{/privacy}","received_events_url":"https://api.github.com/users/almeidap/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2014-08-07T13:08:21Z","updated_at":"2015-03-06T12:01:43Z","closed_at":null,"body":"It seems that I reached the limit of the current layout system of Assemble and I would love to see a more powerful and comprehensive solution to compose my pages.\r\n\r\nFor now, I am using a mix between the default layout system (\\*.hbs files with YAML Front Matter, retrieved by the `layoutdir` options property) and the undocumented `#block`, `#extend` and `#content` layout \"helpers\" (*.hbs files retrieved by the `partials` options property):\r\nhttps://github.com/assemble/handlebars-helpers/blob/master/lib/helpers/helpers-layouts.js\r\n\r\nLooking around, It seems that this topic has been discussed for some time now:\r\n#38, #201, #442, #480, #524, https://github.com/assemble/assemble-handlebars/issues/21, ...\r\n\r\n...and it seems that there is some work on the way:\r\nhttps://github.com/assemble/assemble/issues/524#issuecomment-48524811\r\n\r\nIn fact, IMHO, the `#block`, `#extend` and `#content` system should not be just basic helpers but the **first-class layout system** in Assemble. All my attempts to build my layout inheritance using the layout helpers have failed until now (untraceable exceptions, missing layouts, wrong context, unexpanded expressions, third-party helpers no more working inside `#content` body, etc.). And, to be honest, it's a real pain to understand whats going wrong behind the scene.\r\n\r\nMy suggestion would be to include YAML Front Matter layouts abilities into the current `#block`, `#extend` and `#content` approach, extended with another *tag*: `#layout`. Here is an on-the-fly example:\r\n\r\n## Layouts\r\n### base-layout.hbs\r\n    {{#layout title=\"<%= package.title %>\" uiLayout=\"base\"}}\r\n        <body class=\"{{uiLayout}}\">\r\n            {{#block \"header\"}}\r\n                <h1>{{title}}</h1>\r\n            {{/block}}\r\n            {{#block \"menu\"}}{{/block}}\r\n            {{> body}}\r\n            {{#block \"footer\"}}{{/block}}\r\n        </body>\r\n    {{/layout}}\r\n\r\n### default-layout.hbs\r\n    {{#extend \"base-layout\" pageTitle=\"Default\" uiLayout=\"default\"}}\r\n        {{#content \"header\" mode=\"prepend\"}}\r\n            <p class=\"lead\">{{pageTitle}}</p>\r\n        {{/content}}\r\n        {{#content \"menu\"}}[Default menu]{{/content}}\r\n        {{#content \"footer\"}}2014 (c) MyCompany{{/content }}\r\n        <div id=\"content\">\r\n            {{> body}}\r\n        </div>\r\n    {{/layout}}\r\n\r\n## Pages\r\n### index.hbs\r\n    {{#extend \"default-layout\" pageTitle=\"Welcome\"}}\r\n        <p>Hello World! ;)</p>\r\n    {{/layout}}\r\n\r\nThis would be awesome! I hope that this example is explicit enough to share my idea. Obviously, you should be able to nest `#extend` expressions, *tag* contents should be evaluated as expected and contexts should be adapted with the provided inline *tag* attributes."},"comment":{"url":"https://api.github.com/repos/assemble/assemble/issues/comments/77548869","html_url":"https://github.com/assemble/assemble/issues/555#issuecomment-77548869","issue_url":"https://api.github.com/repos/assemble/assemble/issues/555","id":77548869,"user":{"login":"brunowego","id":441774,"avatar_url":"https://avatars.githubusercontent.com/u/441774?v=3","gravatar_id":"","url":"https://api.github.com/users/brunowego","html_url":"https://github.com/brunowego","followers_url":"https://api.github.com/users/brunowego/followers","following_url":"https://api.github.com/users/brunowego/following{/other_user}","gists_url":"https://api.github.com/users/brunowego/gists{/gist_id}","starred_url":"https://api.github.com/users/brunowego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brunowego/subscriptions","organizations_url":"https://api.github.com/users/brunowego/orgs","repos_url":"https://api.github.com/users/brunowego/repos","events_url":"https://api.github.com/users/brunowego/events{/privacy}","received_events_url":"https://api.github.com/users/brunowego/received_events","type":"User","site_admin":false},"created_at":"2015-03-06T12:01:42Z","updated_at":"2015-03-06T12:01:42Z","body":"+1"}}