{%- comment -%} Resolves a per-surface toggle into `surface_enabled` (true / false). Usage: include surface-enabled.html config=site.right_sidebar.pins.enable ... then test `surface_enabled` The config value may be either form: enable: true -> shown everywhere; any per-surface values are irrelevant because there are none to read enable: false -> hidden everywhere enable: -> resolved per surface, via page-kind.html homepage: true posts: false tabs: true other_pages: false The boolean shorthand is checked first, so `enable: true` short-circuits and never looks at the surfaces. When the value is a boolean, indexing it yields nothing, which is why `enable: false` also lands on hidden. NB: no literal Liquid tags in this comment -- a comment block still tokenises the tags inside it, so an argument-less tag here is a parse error. {%- endcomment -%} {%- include page-kind.html -%} {%- if include.config == true -%} {%- assign surface_enabled = true -%} {%- else -%} {%- assign surface_enabled = include.config[page_kind] -%} {%- endif -%}