~xdavidwu/xdavidwu.link

411395f940591cab16ae5561a95f7da646e51899 — xdavidwu 4 years ago f9ed0d1
move related into article container
2 files changed, 23 insertions(+), 34 deletions(-)

M _layouts/single.html
M _sass/minimal-mistakes/_page.scss
M _layouts/single.html => _layouts/single.html +23 -23
@@ 60,30 60,30 @@ layout: default
    {% if jekyll.environment == 'production' and site.comments.provider and page.comments %}
      {% include comments.html %}
    {% endif %}
  </article>

  {% comment %}<!-- only show related on a post page when `related: true` -->{% endcomment %}
  {% if page.id and page.related and site.related_posts.size > 0 %}
    <div class="page__related">
      <h4 class="page__related-title">{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}</h4>
      <div class="grid__wrapper">
        {% for post in site.related_posts limit:4 %}
          {% include archive-single.html type="grid" %}
        {% endfor %}
    {% comment %}<!-- only show related on a post page when `related: true` -->{% endcomment %}
    {% if page.id and page.related and site.related_posts.size > 0 %}
      <div class="page__related">
        <h4 class="page__related-title">{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}</h4>
        <div class="grid__wrapper">
          {% for post in site.related_posts limit:4 %}
            {% include archive-single.html type="grid" %}
          {% endfor %}
        </div>
      </div>
    </div>
  {% comment %}<!-- otherwise show recent posts if no related when `related: true` -->{% endcomment %}
  {% elsif page.id and page.related %}
    <div class="page__related">
      <h4 class="page__related-title">{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}</h4>
      <div class="grid__wrapper">
        {% for post in site.posts limit:4 %}
          {% if post.id == page.id %}
            {% continue %}
          {% endif %}
          {% include archive-single.html type="grid" %}
        {% endfor %}
    {% comment %}<!-- otherwise show recent posts if no related when `related: true` -->{% endcomment %}
    {% elsif page.id and page.related %}
      <div class="page__related">
        <h4 class="page__related-title">{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}</h4>
        <div class="grid__wrapper">
          {% for post in site.posts limit:4 %}
            {% if post.id == page.id %}
              {% continue %}
            {% endif %}
            {% include archive-single.html type="grid" %}
          {% endfor %}
        </div>
      </div>
    </div>
  {% endif %}
    {% endif %}
  </article>
</div>

M _sass/minimal-mistakes/_page.scss => _sass/minimal-mistakes/_page.scss +0 -11
@@ 464,20 464,9 @@ body {

.page__related {
  @include clearfix();
  float: left;
  margin-top: 2em;
  padding-top: 1em;
  border-top: 1px solid $border-color;
  width: 100%;

  @include breakpoint($large) {
    float: right;
    width: calc(100% - #{$right-sidebar-width-narrow});
  }

  @include breakpoint($x-large) {
    width: calc(100% - #{$right-sidebar-width});
  }

  a {
    color: inherit;