{"action":"created","issue":{"url":"https://api.github.com/repos/Perlkonig/grav-theme-knowledge-base/issues/24","repository_url":"https://api.github.com/repos/Perlkonig/grav-theme-knowledge-base","labels_url":"https://api.github.com/repos/Perlkonig/grav-theme-knowledge-base/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/Perlkonig/grav-theme-knowledge-base/issues/24/comments","events_url":"https://api.github.com/repos/Perlkonig/grav-theme-knowledge-base/issues/24/events","html_url":"https://github.com/Perlkonig/grav-theme-knowledge-base/issues/24","id":349071289,"node_id":"MDU6SXNzdWUzNDkwNzEyODk=","number":24,"title":"Theme inheritance: hardcoded theme names vs. theme config","user":{"login":"domsson","id":7917999,"node_id":"MDQ6VXNlcjc5MTc5OTk=","avatar_url":"https://avatars2.githubusercontent.com/u/7917999?v=4","gravatar_id":"","url":"https://api.github.com/users/domsson","html_url":"https://github.com/domsson","followers_url":"https://api.github.com/users/domsson/followers","following_url":"https://api.github.com/users/domsson/following{/other_user}","gists_url":"https://api.github.com/users/domsson/gists{/gist_id}","starred_url":"https://api.github.com/users/domsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domsson/subscriptions","organizations_url":"https://api.github.com/users/domsson/orgs","repos_url":"https://api.github.com/users/domsson/repos","events_url":"https://api.github.com/users/domsson/events{/privacy}","received_events_url":"https://api.github.com/users/domsson/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-08-09T10:34:45Z","updated_at":"2018-12-31T07:00:04Z","closed_at":"2018-08-09T19:38:27Z","author_association":"NONE","body":"When inheriting from the `knowledge-base` theme, one might wish to change the theme config in the derived theme, without touching the original. And while [Grav apparently does _not_ inherit a base theme's config](https://discourse.getgrav.org/t/theme-inheritance-default-yaml-settings-inheritance/3515), this can be achieved by copying over the `param` section of `user/themes/knowledge-base/knowledge-base.yaml` into the derived theme's config file (underneath or above the `streams` section responsible for the inheritance). \r\n\r\nHowever, `knowledge-base` is accessing the theme config via `config.themes['knowledge-base']`, using the hardcoded theme name. This is `null` in a derived theme. Only `config.themes['derived-theme']` (assuming the name of the child theme to be `derived-them`) is defined there. This leads to at least two issues:\r\n\r\n- The inherited theme breaks in several places (no sidebar, blacklist not working, ...)\r\n- Config changes to the inherited theme (performed as outlined above) take no effect\r\n\r\nThis issue has also been present in the `deliver` theme, leading to [this issue](https://github.com/getgrav/grav/issues/615), for example. The [last reply](https://github.com/getgrav/grav/issues/615#issuecomment-173350683) there also outlines the solution:\r\n\r\n1. Add the following at the top of the base template:\r\n\r\n        {% set theme_config = attribute(config.themes, config.system.pages.theme) %}\r\n\r\nThis is already present in the `knowledge-base\\templates\\partials\\base.html.twig`, but never used.\r\n\r\n2. Then use `theme_config` instead of `config.themes['theme-name']` in all template files.\r\n\r\n`theme_config` will evaluate to `config.themes['knowledge-base']` if the theme is used directly (hence, everything works exactly as before) and to `config.themes['derived-theme']` in a derived theme. As per Flavio Copes' reply linked above, this is how it should be done.\r\n\r\nImplementing this is as trivial as a search and replace in the template files. However, I'm not sure if this could potentially break existing setups for users? I don't think it should, though. Also, I'm wondering why no other users have reported this issue, while there apparently are people who do inherit from `knowledge-base`, as evident by [this issue report](https://github.com/Perlkonig/grav-theme-knowledge-base/issues/9). Shouldn't the sidebar be missing for them, amongst other issues? Maybe I am missing or confusing something here.\r\n\r\nSide note: I think this is a bit of an issue with Grav. One would expect that if a specific config setting is not present in the derived theme's config, Grav would go looking in the base theme's config. This is what the [tutorial about theme inheritance](https://getgrav.org/blog/theme-development-with-inheritance) implies when it says _\"You can of course customize any part of the original base-theme\"_. However, as per my testing as well as the forum link above, this seems not to be the case, making the whole them inheritance a bit inconsistent / counter-intuitive."},"comment":{"url":"https://api.github.com/repos/Perlkonig/grav-theme-knowledge-base/issues/comments/450614289","html_url":"https://github.com/Perlkonig/grav-theme-knowledge-base/issues/24#issuecomment-450614289","issue_url":"https://api.github.com/repos/Perlkonig/grav-theme-knowledge-base/issues/24","id":450614289,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDYxNDI4OQ==","user":{"login":"thomasporhel","id":22839288,"node_id":"MDQ6VXNlcjIyODM5Mjg4","avatar_url":"https://avatars1.githubusercontent.com/u/22839288?v=4","gravatar_id":"","url":"https://api.github.com/users/thomasporhel","html_url":"https://github.com/thomasporhel","followers_url":"https://api.github.com/users/thomasporhel/followers","following_url":"https://api.github.com/users/thomasporhel/following{/other_user}","gists_url":"https://api.github.com/users/thomasporhel/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasporhel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasporhel/subscriptions","organizations_url":"https://api.github.com/users/thomasporhel/orgs","repos_url":"https://api.github.com/users/thomasporhel/repos","events_url":"https://api.github.com/users/thomasporhel/events{/privacy}","received_events_url":"https://api.github.com/users/thomasporhel/received_events","type":"User","site_admin":false},"created_at":"2018-12-31T07:00:04Z","updated_at":"2018-12-31T07:00:04Z","author_association":"NONE","body":"I am very sorry it took me so long to reply. I didn't see your answer.\r\n\r\nI have copied the data from the config file into the active theme config file and indeed it works (-:\r\n\r\nThanks a lot for this awesome theme (-:"}}
{"actor":{"display_login":"thomasporhel"}}