{"action":"closed","issue":{"url":"https://api.github.com/repos/hexojs/hexo/issues/3056","repository_url":"https://api.github.com/repos/hexojs/hexo","labels_url":"https://api.github.com/repos/hexojs/hexo/issues/3056/labels{/name}","comments_url":"https://api.github.com/repos/hexojs/hexo/issues/3056/comments","events_url":"https://api.github.com/repos/hexojs/hexo/issues/3056/events","html_url":"https://github.com/hexojs/hexo/issues/3056","id":301156839,"number":3056,"title":"Custom page locals and front-matter defined variables","user":{"login":"garydouble","id":7853281,"avatar_url":"https://avatars0.githubusercontent.com/u/7853281?v=4","gravatar_id":"","url":"https://api.github.com/users/garydouble","html_url":"https://github.com/garydouble","followers_url":"https://api.github.com/users/garydouble/followers","following_url":"https://api.github.com/users/garydouble/following{/other_user}","gists_url":"https://api.github.com/users/garydouble/gists{/gist_id}","starred_url":"https://api.github.com/users/garydouble/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garydouble/subscriptions","organizations_url":"https://api.github.com/users/garydouble/orgs","repos_url":"https://api.github.com/users/garydouble/repos","events_url":"https://api.github.com/users/garydouble/events{/privacy}","received_events_url":"https://api.github.com/users/garydouble/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-28T19:43:39Z","updated_at":"2018-03-15T17:45:51Z","closed_at":"2018-03-15T17:45:50Z","author_association":"NONE","body":"## Environment Info\r\n\r\nNode v9.6.1\r\n\r\nejs@2.5.7\r\nhexo@3.5.0\r\nhexo-generator-archive@0.1.5\r\nhexo-generator-category@0.1.3\r\nhexo-generator-index@0.2.1\r\nhexo-generator-tag@0.2.0\r\nhexo-renderer-ejs@0.3.1\r\nhexo-renderer-marked@0.3.2\r\nhexo-renderer-stylus@0.3.3\r\nhexo-server@0.3.1\r\n\r\n## Question\r\n\r\nHello lovely people.\r\n\r\nI'm trying to sort a new theme out but want to be able to customise certain elements from within the front-matters.\r\n\r\nFor example, say I have this in my layout file:\r\n\r\n    // layout.ejs\r\n    <h1 class=\"<%- page.customHeaderClass %>\"><%= page.title %><h1>\r\n\r\nThen for any post or page I'd like to control it using:\r\n\r\n    // random-page/index.md\r\n    ---\r\n    title: Something awesome\r\n    ...\r\n    customHeaderClass: fancy-font-1\r\n    ---\r\n\r\nI've tried a few things to make this work (including forking the repo and tinkering about) but I can't seem to get it working for my pages.\r\nIs this a limitation with using the warehouse data models? Or is there a setting / plug-in somewhere that will allow me to do this.\r\n\r\nSo, in a one-liner: **How do I get front-matter defined variables to stick on the page / post objects within theme layouts?**\r\n\r\nI'm fairly new to Hexo, but I have to say, so far, the experience has been an extremely positive one and I look forward to diving deeper into it.\r\nThanks in advance.\r\nGary D."}}
{"actor":{"display_login":"garydouble"}}