{%- comment -%} Sets `page_kind` to one of: homepage | posts | tabs | other_pages. Used to index the per-surface toggles in _config.yml, e.g. `site.right_sidebar.disclaimer.enable[page_kind]`. Keeping the test in one place means the panels cannot drift apart on what counts as a "tab". The layout name settles the first two: 'home' for the home page, 'post' for posts and drafts. Tabs are matched on the collection instead, because the seven of them use seven different layouts (page, archives, categories, books, poem-index, tags), so there is no single layout name to test. Whatever is left -- individual poems, book chapters -- falls through to other_pages. An assign inside an include is visible to the caller, so including this file is enough to define `page_kind`. NB: no literal Liquid tags in this comment -- a comment block still tokenises the tags inside it, so an argument-less assign here is a parse error. {%- endcomment -%} {%- if page.layout == 'home' -%} {%- assign page_kind = 'homepage' -%} {%- elsif page.layout == 'post' -%} {%- assign page_kind = 'posts' -%} {%- elsif page.collection == 'tabs' -%} {%- assign page_kind = 'tabs' -%} {%- else -%} {%- assign page_kind = 'other_pages' -%} {%- endif -%}