Skip to content

Use wide class if no ToC #2496

Answered by tobiasvl
tobiasvl asked this question in Q&A
Discussion options

You must be logged in to vote

@iBug Thanks for getting me on the right track. There's probably a much better and shorter way to do it than this, but I'm not too familiar with Liquid. It works, though!

_layouts/default.html

  {% unless page.toc %}
    {% if page.classes or layout.classes %}
      {% assign classes = page.classes | default: layout.classes | push: 'wide' %}
    {% else %}
      {% assign classes = 'wide,' | split: ',' %}
    {% endif %}
  {% else %}
    {% if page.classes or layout.classes %}
      {% assign classes = page.classes | default: layout.classes %}
    {% else %}
      {% assign classes = '' | split: '' %}
    {% endif %}
  {% endunless %}

  <body class="layout--{{ page.layout | default: layo…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by tobiasvl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2496 on December 22, 2020 15:28.